From: Jeff Layton <jlayton@kernel.org>
To: Olga Kornievskaia <okorniev@redhat.com>, chuck.lever@oracle.com
Cc: linux-nfs@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/1] nfsd: fix possible badness in FREE_STATEID
Date: Sat, 05 Oct 2024 07:05:55 -0400 [thread overview]
Message-ID: <7180552b71bba28ede59b9fbc9387eb63cdac878.camel@kernel.org> (raw)
In-Reply-To: <20241004220403.50034-1-okorniev@redhat.com>
On Fri, 2024-10-04 at 18:04 -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
> 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);
Nice catch.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-10-05 11:05 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 [this message]
2024-10-05 11:23 ` Benjamin Coddington
2024-10-05 14:53 ` Chuck Lever
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=7180552b71bba28ede59b9fbc9387eb63cdac878.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--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