diff options
author | Trond Myklebust <trondmy@gmail.com> | 2020-01-06 21:40:34 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-24 10:36:55 +0300 |
commit | 707518c16ba400ac43e629f1b72e8efeb5895803 (patch) | |
tree | f8792b0dad55d0c39de3f3fd4363092057a8f900 | |
parent | 46503858e275957cb5782db43690d24a44630584 (diff) | |
download | linux-707518c16ba400ac43e629f1b72e8efeb5895803.tar.xz |
sunrpc: Fix potential leaks in sunrpc_cache_unhash()
[ Upstream commit 1d82163714c16ebe09c7a8c9cd3cef7abcc16208 ]
When we unhash the cache entry, we need to handle any pending upcalls
by calling cache_fresh_unlocked().
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | net/sunrpc/cache.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index f740cb51802a..7ede1e52fd81 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1888,7 +1888,9 @@ void sunrpc_cache_unhash(struct cache_detail *cd, struct cache_head *h) if (!hlist_unhashed(&h->cache_list)){ hlist_del_init_rcu(&h->cache_list); cd->entries--; + set_bit(CACHE_CLEANED, &h->flags); spin_unlock(&cd->hash_lock); + cache_fresh_unlocked(h, cd); cache_put(h, cd); } else spin_unlock(&cd->hash_lock); |