linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Trond Myklebust <trondmy@gmail.com>,
	Trond Myklebust <trond.myklebust@hammerspace.com>,
	"J . Bruce Fields" <bfields@redhat.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-nfs@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 378/459] sunrpc: Fix potential leaks in sunrpc_cache_unhash()
Date: Fri, 14 Feb 2020 11:00:28 -0500	[thread overview]
Message-ID: <20200214160149.11681-378-sashal@kernel.org> (raw)
In-Reply-To: <20200214160149.11681-1-sashal@kernel.org>

From: Trond Myklebust <trondmy@gmail.com>

[ 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>
---
 net/sunrpc/cache.c | 2 ++
 1 file changed, 2 insertions(+)

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);
-- 
2.20.1


  parent reply	other threads:[~2020-02-14 17:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200214160149.11681-1-sashal@kernel.org>
2020-02-14 15:54 ` [PATCH AUTOSEL 5.4 006/459] nfsd4: avoid NULL deference on strange COPY compounds Sasha Levin
2020-02-14 15:55 ` [PATCH AUTOSEL 5.4 068/459] nfs: NFS_SWAP should depend on SWAP Sasha Levin
2020-02-14 15:57 ` [PATCH AUTOSEL 5.4 207/459] nfsd: Clone should commit src file metadata too Sasha Levin
2020-02-14 15:59 ` [PATCH AUTOSEL 5.4 320/459] NFS: Revalidate the file size on a fatal write error Sasha Levin
2020-02-14 15:59 ` [PATCH AUTOSEL 5.4 321/459] NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes() Sasha Levin
2020-02-14 16:00 ` Sasha Levin [this message]
2020-02-14 16:01 ` [PATCH AUTOSEL 5.4 445/459] NFSv4: pnfs_roc() must use cred_fscmp() to compare creds Sasha Levin
2020-02-14 16:01 ` [PATCH AUTOSEL 5.4 451/459] NFS: Fix memory leaks Sasha Levin
2020-02-14 16:01 ` [PATCH AUTOSEL 5.4 452/459] NFSv4: try lease recovery on NFS4ERR_EXPIRED Sasha Levin
2020-02-14 16:01 ` [PATCH AUTOSEL 5.4 453/459] NFSv4.0: nfs4_do_fsinfo() should not do implicit lease renewals Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200214160149.11681-378-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=bfields@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=trondmy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).