Linux NFS development
 help / color / mirror / Atom feed
From: Bruce Fields <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Colin King <colin.king@canonical.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] nfsd: fix check of statid returned from call to find_stateid_by_type
Date: Thu, 28 Jan 2021 10:17:15 -0500	[thread overview]
Message-ID: <20210128151715.GA29887@fieldses.org> (raw)
In-Reply-To: <793C88A3-B117-4138-B74A-845E0BD383C9@oracle.com>

On Thu, Jan 28, 2021 at 03:05:06PM +0000, Chuck Lever wrote:
> Hi Colin-
> 
> > On Jan 28, 2021, at 9:49 AM, Colin King <colin.king@canonical.com> wrote:
> > 
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > The call to find_stateid_by_type is setting the return value in *stid
> > yet the NULL check of the return is checking stid instead of *stid.
> > Fix this by adding in the missing pointer * operator.
> > 
> > Addresses-Coverity: ("Dereference before null check")
> > Fixes: 6cdaa72d4dde ("nfsd: find_cpntf_state cleanup")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Thanks for your patch. I've committed it to the for-next branch at
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git
> 
> in preparation for the v5.12 merge window, with the following changes:
> 
> - ^statid^stateid
> - Fixes: tag removed, since no stable backport is necessary

Please keep the "Fixes:" tag!  It's still very useful information.  For
example, if someone needs to backport the original patch, this is a
reminder they'll want this one as well.

(Of course, if you fold this patch into the earlier one instead, that's
a different situation.)

--b.

> The commit you are fixing has not been merged upstream yet.
> 
> 
> > ---
> > fs/nfsd/nfs4state.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > index f554e3480bb1..423fd6683f3a 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -5824,7 +5824,7 @@ static __be32 find_cpntf_state(struct nfsd_net *nn, stateid_t *st,
> > 
> > 	*stid = find_stateid_by_type(found, &cps->cp_p_stateid,
> > 			NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID);
> > -	if (stid)
> > +	if (*stid)
> > 		status = nfs_ok;
> > 	else
> > 		status = nfserr_bad_stateid;
> > -- 
> > 2.29.2
> > 
> 
> --
> Chuck Lever
> 
> 

  reply	other threads:[~2021-01-28 15:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 14:49 [PATCH][next] nfsd: fix check of statid returned from call to find_stateid_by_type Colin King
2021-01-28 15:05 ` Chuck Lever
2021-01-28 15:17   ` Bruce Fields [this message]
2021-01-28 15:34   ` Dan Carpenter
2021-01-28 15:53     ` Chuck Lever
2021-01-28 18:50       ` Bruce Fields

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=20210128151715.GA29887@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@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