summaryrefslogtreecommitdiff
path: root/include/linux/rhashtable.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-03-24 09:53:17 +1100
committerDavid S. Miller <davem@davemloft.net>2015-03-23 22:16:07 -0400
commitba7c95ea3870fe7b847466d39a049ab6f156aa2c (patch)
tree8fed9deb6a4a0c1f52634ff0bd07fb6a0edb8dde /include/linux/rhashtable.h
parentce046c568cbfb4734583131086f88cfe993c01d0 (diff)
rhashtable: Fix sleeping inside RCU critical section in walk_stop
The commit 963ecbd41a1026d99ec7537c050867428c397b89 ("rhashtable: Fix use-after-free in rhashtable_walk_stop") fixed a real bug but created another one because we may end up sleeping inside an RCU critical section. This patch fixes it properly by replacing the mutex with a spin lock that specifically protects the walker lists. Reported-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-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.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index f9ecf32bce55..d7be9cb0e91f 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -133,6 +133,7 @@ struct rhashtable_params {
* @p: Configuration parameters
* @run_work: Deferred worker to expand/shrink asynchronously
* @mutex: Mutex to protect current/future table swapping
+ * @lock: Spin lock to protect walker list
* @being_destroyed: True if table is set up for destruction
*/
struct rhashtable {
@@ -144,6 +145,7 @@ struct rhashtable {
struct rhashtable_params p;
struct work_struct run_work;
struct mutex mutex;
+ spinlock_t lock;
};
/**