瀏覽代碼

[PATCH] IB: Fix FMR pool crash

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>
Roland Dreier 20 年之前
父節點
當前提交
de0d9641c4
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      drivers/infiniband/core/fmr_pool.c

+ 2 - 3
drivers/infiniband/core/fmr_pool.c

@@ -103,9 +103,8 @@ struct ib_fmr_pool {
 
 
 static inline u32 ib_fmr_hash(u64 first_page)
 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 */
 /* Caller must hold pool_lock */