diff options
author | Thomas Graf <tgraf@suug.ch> | 2015-02-06 16:08:43 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-06 15:19:17 -0800 |
commit | 020219a69d40a205dad12b0ea1e6a46153793368 (patch) | |
tree | 0dec904a1fcc46dc6758c673afda340bf1da4475 /net | |
parent | 41e8b206f8df6daf90e132a73fc2c60f51a36c6b (diff) | |
download | linux-020219a69d40a205dad12b0ea1e6a46153793368.tar.bz2 |
rhashtable: Fix remove logic to avoid cross references between buckets
The remove logic properly searched the remaining chain for a matching
entry with an identical hash but it did this while searching from both
the old and new table. Instead in order to not leave stale references
behind we need to:
1. When growing and searching from the new table:
Search remaining chain for entry with same hash to avoid having
the new table directly point to a entry with a different hash.
2. When shrinking and searching from the old table:
Check if the element after the removed would create a cross
reference and avoid it if so.
These bugs were present from the beginning in nft_hash.
Also, both insert functions calculated the hash based on the mask of
the new table. This worked while growing. Wwhile shrinking, the mask
of the inew table is smaller than the mask of the old table. This lead
to a bit not being taken into account when selecting the bucket lock
and thus caused the wrong bucket to be locked eventually.
Fixes: 7e1e77636e36 ("lib: Resizable, Scalable, Concurrent Hash Table")
Fixes: 97defe1ecf86 ("rhashtable: Per bucket locks & deferred expansion/shrinking")
Reported-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions