aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/rhashtable.h
diff options
context:
space:
mode:
authorPaul Blakey <paulb@mellanox.com>2018-03-04 17:29:48 +0200
committerDavid S. Miller <davem@davemloft.net>2018-03-07 10:44:02 -0500
commitd3dcf8eb615537526bd42ff27a081d46d337816e (patch)
treeb9d783bcc753f9a78d238535a30a55050413eca8 /include/linux/rhashtable.h
parentdt-bindings: net: renesas-ravb: Make stream buffer optional (diff)
downloadwireguard-linux-d3dcf8eb615537526bd42ff27a081d46d337816e.tar.xz
wireguard-linux-d3dcf8eb615537526bd42ff27a081d46d337816e.zip
rhashtable: Fix rhlist duplicates insertion
When inserting duplicate objects (those with the same key), current rhlist implementation messes up the chain pointers by updating the bucket pointer instead of prev next pointer to the newly inserted node. This causes missing elements on removal and travesal. Fix that by properly updating pprev pointer to point to the correct rhash_head next pointer. Issue: 1241076 Change-Id: I86b2c140bcb4aeb10b70a72a267ff590bb2b17e7 Fixes: ca26893f05e8 ('rhashtable: Add rhlist interface') Signed-off-by: Paul Blakey <paulb@mellanox.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/rhashtable.h')
-rw-r--r--include/linux/rhashtable.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index c9df2527e0cd..668a21f04b09 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -766,8 +766,10 @@ slow_path:
if (!key ||
(params.obj_cmpfn ?
params.obj_cmpfn(&arg, rht_obj(ht, head)) :
- rhashtable_compare(&arg, rht_obj(ht, head))))
+ rhashtable_compare(&arg, rht_obj(ht, head)))) {
+ pprev = &head->next;
continue;
+ }
data = rht_obj(ht, head);