[PATCH] IB: Fix FMR pool crash
authorRoland Dreier <roland@topspin.com>
Sat, 16 Apr 2005 22:26:10 +0000 (15:26 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 16 Apr 2005 22:26:10 +0000 (15:26 -0700)
Mask bits correctly from jhash result in ib_fmr_hash() so that the
computed bucket index is within our hash table.  This fixes an SDP
crash.

Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/infiniband/core/fmr_pool.c

index 2e9469f189263bd56bea876cf976a7bb8fdb22e2..59ee001ff05b1f212fa64b08a2f35cce1a04668b 100644 (file)
@@ -103,9 +103,8 @@ struct ib_fmr_pool {
 
 static inline u32 ib_fmr_hash(u64 first_page)
 {
-       return jhash_2words((u32) first_page,
-                           (u32) (first_page >> 32),
-                           0);
+       return jhash_2words((u32) first_page, (u32) (first_page >> 32), 0) &
+               (IB_FMR_HASH_SIZE - 1);
 }
 
 /* Caller must hold pool_lock */