blob: f55fa5abe253842ecf72e5cfaf97dacec139c42f [file] [log] [blame]
From 2d38a9e4e0c40aaabf4491241e0fdf10895e688e Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trondmy@gmail.com>
Date: Mon, 6 Jan 2020 13:40:34 -0500
Subject: [PATCH] sunrpc: Fix potential leaks in sunrpc_cache_unhash()
commit 1d82163714c16ebe09c7a8c9cd3cef7abcc16208 upstream.
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: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index bb70ecb734a2..1270d26990fb 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1882,7 +1882,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);
--
2.7.4