rhashtable: Avoid bucket cross reference after removal
authorThomas Graf <tgraf@suug.ch>
Thu, 5 Feb 2015 01:03:36 +0000 (02:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Feb 2015 23:18:35 +0000 (15:18 -0800)
commitcf52d52f9ccb9966ac019d9f79824195583e3e6c
tree709001bcb9373ca4d622f70d4c48095aea4d1a61
parent7cd10db8de2b6a32ccabef2e0e01c7444faa49d4
rhashtable: Avoid bucket cross reference after removal

During a resize, when two buckets in the larger table map to
a single bucket in the smaller table and the new table has already
been (partially) linked to the old table. Removal of an element
may result the bucket in the larger table to point to entries
which all hash to a different value than the bucket index. Thus
causing two buckets to point to the same sub chain after unzipping.
This is not illegal *during* the resize phase but after it has
completed.

Keep the old table around until all of the unzipping is done to
allow the removal code to only search for matching hashed entries
during this special period.

Reported-by: Ying Xue <ying.xue@windriver.com>
Fixes: 97defe1ecf86 ("rhashtable: Per bucket locks & deferred expansion/shrinking")
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c