OSDN Git Service

rhashtable: Fix rhlist duplicates insertion
authorPaul Blakey <paulb@mellanox.com>
Sun, 4 Mar 2018 15:29:48 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Mar 2018 16:11:33 +0000 (18:11 +0200)
commitad6217049ef4262b7926f4339095a41aaa7844a5
tree38cd96cbf982adabe35d717196a11b75144555b5
parentfe3627f6761c40a408d426488fb638bc3c6a8ab7
rhashtable: Fix rhlist duplicates insertion

[ Upstream commit d3dcf8eb615537526bd42ff27a081d46d337816e ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/rhashtable.h
lib/rhashtable.c