From: Chuck Lever <chuck.lever@oracle.com>
To: Olga Kornievskaia <okorniev@redhat.com>
Cc: "jlayton@kernel.org" <jlayton@kernel.org>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH 1/1] nfsd: fix possible badness in FREE_STATEID
Date: Sat, 5 Oct 2024 10:53:28 -0400 [thread overview]
Message-ID: <ZwFS6P3Ni7KdTyJs@tissot.1015granger.net> (raw)
In-Reply-To: <20241004220403.50034-1-okorniev@redhat.com>
On Fri, Oct 04, 2024 at 06:04:03PM -0400, Olga Kornievskaia wrote:
> When multiple FREE_STATEIDs are sent for the same delegation stateid,
> it can lead to a possible either use-after-tree or counter refcount
> underflow errors.
>
> In nfsd4_free_stateid() under the client lock we find a delegation
> stateid, however the code drops the lock before calling nfs4_put_stid(),
> that allows another FREE_STATE to find the stateid again. The first one
> will proceed to then free the stateid which leads to either
> use-after-free or decrementing already zerod counter.
>
> CC: stable@vger.kernel.org
I assume that the broken commit is pretty old, but this fix does not
apply before v6.9 (where sc_status is introduced). I can add
"# v6.9+" to the Cc: stable tag.
But what do folks think about a Fixes: tag?
Could be e1ca12dfb1be ("NFSD: added FREE_STATEID operation"), but
that doesn't have the switch statement, which was added by
2da1cec713bc ("nfsd4: simplify free_stateid").
> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
> ---
> fs/nfsd/nfs4state.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index ac1859c7cc9d..56b261608af4 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -7154,6 +7154,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> switch (s->sc_type) {
> case SC_TYPE_DELEG:
> if (s->sc_status & SC_STATUS_REVOKED) {
> + s->sc_status |= SC_STATUS_CLOSED;
> spin_unlock(&s->sc_lock);
> dp = delegstateid(s);
> list_del_init(&dp->dl_recall_lru);
> --
> 2.43.5
>
--
Chuck Lever
next prev parent reply other threads:[~2024-10-05 14:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 22:04 [PATCH 1/1] nfsd: fix possible badness in FREE_STATEID Olga Kornievskaia
2024-10-05 11:05 ` Jeff Layton
2024-10-05 11:23 ` Benjamin Coddington
2024-10-05 14:53 ` Chuck Lever [this message]
2024-10-05 16:20 ` Jeff Layton
2024-10-05 17:56 ` Chuck Lever
2024-10-05 21:04 ` NeilBrown
2024-10-07 15:26 ` Olga Kornievskaia
2024-10-08 1:52 ` NeilBrown
2024-10-08 13:32 ` Chuck Lever III
2024-10-09 18:40 ` cel
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=ZwFS6P3Ni7KdTyJs@tissot.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=okorniev@redhat.com \
--cc=stable@vger.kernel.org \
/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