From: Christoph Hellwig <hch@lst.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
Neil Brown <neilb@suse.de>, Al Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@lst.de>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfsd: fix NULL dereference in nfsd_statfs()
Date: Fri, 13 Aug 2010 16:42:27 +0200 [thread overview]
Message-ID: <20100813144227.GA9155@lst.de> (raw)
In-Reply-To: <s5h4oeywrde.wl%tiwai@suse.de>
On Fri, Aug 13, 2010 at 03:53:49PM +0200, Takashi Iwai wrote:
> The commit ebabe9a9001af0af56c0c2780ca1576246e7a74b
> pass a struct path to vfs_statfs
> introduced the struct path initialization, and this seems to trigger
> an Oops on my machine.
>
> fh_dentry field may be NULL and set later in fh_verify(), thus the
> initialization of path must be after fh_verify().
Thanks, the patch looks good.
Reviewed-by: Christoph Hellwig <hch@lst.de>
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 96360a8..661a6cf 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -2033,15 +2033,17 @@ out:
> __be32
> nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat, int access)
> {
> - struct path path = {
> - .mnt = fhp->fh_export->ex_path.mnt,
> - .dentry = fhp->fh_dentry,
> - };
> __be32 err;
>
> err = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP | access);
> - if (!err && vfs_statfs(&path, stat))
> - err = nfserr_io;
> + if (!err) {
> + struct path path = {
> + .mnt = fhp->fh_export->ex_path.mnt,
> + .dentry = fhp->fh_dentry,
> + };
> + if (vfs_statfs(&path, stat))
> + err = nfserr_io;
> + }
> return err;
> }
>
> --
> 1.7.2.1
---end quoted text---
next prev parent reply other threads:[~2010-08-13 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-13 13:53 [PATCH] nfsd: fix NULL dereference in nfsd_statfs() Takashi Iwai
2010-08-13 14:42 ` Christoph Hellwig [this message]
2010-08-14 1:32 ` Minchan Kim
2010-08-14 13:02 ` J. Bruce Fields
2010-08-20 21:29 ` J. 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=20100813144227.GA9155@lst.de \
--to=hch@lst.de \
--cc=bfields@fieldses.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tiwai@suse.de \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).