From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>
Cc: Wentao Liang <vulab@iscas.ac.cn>,
Dai.Ngo@oracle.com, akpm@osdl.org, chuck.lever@oracle.com,
linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
neil@brown.name, okorniev@redhat.com, tom@talpey.com,
stable@vger.kernel.org
Subject: Re: [PATCH] nfsd: Fix id-to-name cache entry leak in idtoname_parse()
Date: Thu, 17 Sep 2026 16:04:21 -0400 [thread overview]
Message-ID: <8e430ea8692853928f71d65f15654751a9888c4f.camel@kernel.org> (raw)
In-Reply-To: <9cc180f6-f408-42f2-b143-e155df6f542a@slotpi15m67>
On Thu, 2026-09-17 at 14:53 -0400, Chuck Lever wrote:
> On Thu, 2026-09-17 at 14:10 -0400, Jeff Layton wrote:
> > Looks like we have the same bug later if idtoname_update() fails too?
>
> I don't think so: when sunrpc_cache_update() fails to allocate the
> replacement entry, it drops the reference on the old entry itself:
>
> tmp = detail->alloc();
> if (!tmp) {
> cache_put(old, detail);
> return NULL;
> }
>
> So that exit is already balanced.
>
> > +out_put:
> > + cache_put(&res->h, cd);
> > out:
>
> On the update failure path, res is NULL here, and cache_put()
> dereferences it. A shared label would need the "if (res)" guard that
> expkey_parse() uses.
>
> A shared put label might be a reasonable clean-up, but for a fix
> headed to stable, the two-line version Wentao posted looks OK
> to me.
>
I stand corrected then re: the other bug. It might be nice to clean
that up and make the refcounting more evident, but I agree that should
wait for a later patch.
You can add this:
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-09-17 20:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 16:31 Wentao Liang
2026-09-17 18:10 ` Jeff Layton
2026-09-17 18:53 ` Chuck Lever
2026-09-17 20:04 ` Jeff Layton [this message]
2026-09-18 1:57 ` Chuck Lever
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=8e430ea8692853928f71d65f15654751a9888c4f.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=akpm@osdl.org \
--cc=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tom@talpey.com \
--cc=vulab@iscas.ac.cn \
/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
all inboxes | Powered by JetHome®