From: Trond Myklebust Date: Mon, 6 Jan 2020 18:40:34 +0000 (-0500) Subject: sunrpc: Fix potential leaks in sunrpc_cache_unhash() X-Git-Tag: v5.5.6~76 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6affad9aded3dd6879ad852be8bf993f6071f106;p=users%2Fdwmw2%2Flinux.git 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 Signed-off-by: J. Bruce Fields Signed-off-by: Sasha Levin --- diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index f740cb51802af..7ede1e52fd812 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);