RDS: memory allocated must be align to 8
authorshamir rabinovitch <shamir.rabinovitch@oracle.com>
Thu, 7 Apr 2016 11:57:35 +0000 (07:57 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Apr 2016 20:58:27 +0000 (16:58 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/page.c

index 616f21f4e7d7c9f9987c1a0206bab68e589040d7..e2b5a5832d3d52888f11e8730a27d937510e151d 100644 (file)
@@ -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;
                        }