* [PATCH] nfsd: fix NULL dereference in nfsd_statfs()
@ 2010-08-13 13:53 Takashi Iwai
2010-08-13 14:42 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Takashi Iwai @ 2010-08-13 13:53 UTC (permalink / raw)
To: J. Bruce Fields
Cc: Neil Brown, Al Viro, Christoph Hellwig, linux-nfs, linux-kernel
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().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
fs/nfsd/vfs.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] nfsd: fix NULL dereference in nfsd_statfs()
2010-08-13 13:53 [PATCH] nfsd: fix NULL dereference in nfsd_statfs() Takashi Iwai
@ 2010-08-13 14:42 ` Christoph Hellwig
2010-08-14 1:32 ` Minchan Kim
2010-08-14 13:02 ` J. Bruce Fields
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2010-08-13 14:42 UTC (permalink / raw)
To: Takashi Iwai
Cc: J. Bruce Fields, Neil Brown, Al Viro, Christoph Hellwig,
linux-nfs, linux-kernel
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---
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] nfsd: fix NULL dereference in nfsd_statfs()
2010-08-13 13:53 [PATCH] nfsd: fix NULL dereference in nfsd_statfs() Takashi Iwai
2010-08-13 14:42 ` Christoph Hellwig
@ 2010-08-14 1:32 ` Minchan Kim
2010-08-14 13:02 ` J. Bruce Fields
2 siblings, 0 replies; 5+ messages in thread
From: Minchan Kim @ 2010-08-14 1:32 UTC (permalink / raw)
To: Takashi Iwai
Cc: J. Bruce Fields, Neil Brown, Al Viro, Christoph Hellwig,
linux-nfs, linux-kernel, Andrew Morton
On Fri, Aug 13, 2010 at 10:53 PM, Takashi Iwai <tiwai@suse.de> 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().
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Today, I had a same problem on mmotm so I made a similar patch.
Andrew. Please apply this patch on mmotm for smooth testing.
--
Kind regards,
Minchan Kim
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nfsd: fix NULL dereference in nfsd_statfs()
2010-08-13 13:53 [PATCH] nfsd: fix NULL dereference in nfsd_statfs() Takashi Iwai
2010-08-13 14:42 ` Christoph Hellwig
2010-08-14 1:32 ` Minchan Kim
@ 2010-08-14 13:02 ` J. Bruce Fields
2010-08-20 21:29 ` J. Bruce Fields
2 siblings, 1 reply; 5+ messages in thread
From: J. Bruce Fields @ 2010-08-14 13:02 UTC (permalink / raw)
To: Takashi Iwai
Cc: Neil Brown, Al Viro, Christoph Hellwig, linux-nfs, linux-kernel
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().
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
I'm travelling, but, looks good:
Acked-by: J. Bruce Fields <bfields@redhat.com>
--b.
> ---
> fs/nfsd/vfs.c | 14 ++++++++------
> 1 files changed, 8 insertions(+), 6 deletions(-)
>
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] nfsd: fix NULL dereference in nfsd_statfs()
2010-08-14 13:02 ` J. Bruce Fields
@ 2010-08-20 21:29 ` J. Bruce Fields
0 siblings, 0 replies; 5+ messages in thread
From: J. Bruce Fields @ 2010-08-20 21:29 UTC (permalink / raw)
To: Takashi Iwai
Cc: Neil Brown, Al Viro, Christoph Hellwig, linux-nfs, linux-kernel
On Sat, Aug 14, 2010 at 09:02:35AM -0400, J. Bruce Fields wrote:
> 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().
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
>
> I'm travelling, but, looks good:
>
> Acked-by: J. Bruce Fields <bfields@redhat.com>
Sorry for the delay, queued up to send to Linus for 2.6.36 soon.
--b.
>
> --b.
>
> > ---
> > fs/nfsd/vfs.c | 14 ++++++++------
> > 1 files changed, 8 insertions(+), 6 deletions(-)
> >
> > 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
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-20 21:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 13:53 [PATCH] nfsd: fix NULL dereference in nfsd_statfs() Takashi Iwai
2010-08-13 14:42 ` Christoph Hellwig
2010-08-14 1:32 ` Minchan Kim
2010-08-14 13:02 ` J. Bruce Fields
2010-08-20 21:29 ` J. Bruce Fields
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).