public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Dan Carpenter <error27@gmail.com>
Cc: Neil Brown <neilb@suse.de>,
	linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] nfsd: fix NULL dereference in setattr()
Date: Wed, 27 Oct 2010 21:50:25 +0000	[thread overview]
Message-ID: <20101027215025.GB29477@fieldses.org> (raw)
In-Reply-To: <20101027211904.GJ6062@bicker>

On Wed, Oct 27, 2010 at 11:19:04PM +0200, Dan Carpenter wrote:
> The original code would oops if this were called from nfsd4_setattr()
> because "filpp" is NULL.

I believe it's impossible to reach this case: we never give out write
delegations, so the preceding nfs4_check_delegmode will always fail when
called from setattr.

We should do this anyway, but I'll probably queue it up for the next
merge window.

--b.

> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 9019e8e..e044d04 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -3083,9 +3083,10 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
>  		if (status)
>  			goto out;
>  		renew_client(dp->dl_client);
> -		if (filpp)
> +		if (filpp) {
>  			*filpp = find_readable_file(dp->dl_file);
> -		BUG_ON(!*filpp);
> +			BUG_ON(!*filpp);
> +		}
>  	} else { /* open or lock stateid */
>  		stp = find_stateid(stateid, flags);
>  		if (!stp)

  reply	other threads:[~2010-10-27 21:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 21:19 [patch] nfsd: fix NULL dereference in setattr() Dan Carpenter
2010-10-27 21:50 ` J. Bruce Fields [this message]
2010-10-27 22:20   ` Dan Carpenter

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=20101027215025.GB29477@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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