Message ID | 1460030256-16791-1-git-send-email-shamir.rabinovitch@oracle.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On 4/7/2016 4:57 AM, Shamir Rabinovitch wrote: > Fix issue in 'rds_ib_cong_recv' when accessing unaligned memory > allocated by 'rds_page_remainder_alloc' using uint64_t pointer. > Sorry I still didn't follow this change still. What exactly is the problem. > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> > --- > net/rds/page.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/rds/page.c b/net/rds/page.c > index 616f21f..e2b5a58 100644 > --- a/net/rds/page.c > +++ b/net/rds/page.c > @@ -135,8 +135,8 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes, > if (rem->r_offset != 0) > rds_stats_inc(s_page_remainder_hit); > > - rem->r_offset += bytes; > - if (rem->r_offset == PAGE_SIZE) { > + rem->r_offset += ALIGN(bytes, 8); > + if (rem->r_offset >= PAGE_SIZE) { > __free_page(rem->r_page); > rem->r_page = NULL; > } >
From: santosh shilimkar <santosh.shilimkar@oracle.com> Date: Fri, 8 Apr 2016 12:44:39 -0700 > On 4/7/2016 4:57 AM, Shamir Rabinovitch wrote: >> Fix issue in 'rds_ib_cong_recv' when accessing unaligned memory >> allocated by 'rds_page_remainder_alloc' using uint64_t pointer. >> > Sorry I still didn't follow this change still. What exactly is the > problem. You can't stop the offset at non-8byte intervals, because the chunks being used in these arenas can have 64-bit values in it, which must be 8-byte aligned. It looks extremely obvious to me.
On 4/8/2016 1:10 PM, David Miller wrote: > From: santosh shilimkar <santosh.shilimkar@oracle.com> > Date: Fri, 8 Apr 2016 12:44:39 -0700 > >> On 4/7/2016 4:57 AM, Shamir Rabinovitch wrote: >>> Fix issue in 'rds_ib_cong_recv' when accessing unaligned memory >>> allocated by 'rds_page_remainder_alloc' using uint64_t pointer. >>> >> Sorry I still didn't follow this change still. What exactly is the >> problem. > > You can't stop the offset at non-8byte intervals, because the chunks > being used in these arenas can have 64-bit values in it, which must be > 8-byte aligned. > I see. Thanks for explaining it Dave. Its fine to apply then. Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Regards, Santosh
diff --git a/net/rds/page.c b/net/rds/page.c index 616f21f..e2b5a58 100644 --- a/net/rds/page.c +++ b/net/rds/page.c @@ -135,8 +135,8 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes, if (rem->r_offset != 0) rds_stats_inc(s_page_remainder_hit); - rem->r_offset += bytes; - if (rem->r_offset == PAGE_SIZE) { + rem->r_offset += ALIGN(bytes, 8); + if (rem->r_offset >= PAGE_SIZE) { __free_page(rem->r_page); rem->r_page = NULL; }
Fix issue in 'rds_ib_cong_recv' when accessing unaligned memory allocated by 'rds_page_remainder_alloc' using uint64_t pointer. Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> --- net/rds/page.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)