lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100813144227.GA9155@lst.de>
Date:	Fri, 13 Aug 2010 16:42:27 +0200
From:	Christoph Hellwig <hch@....de>
To:	Takashi Iwai <tiwai@...e.de>
Cc:	"J. Bruce Fields" <bfields@...ldses.org>,
	Neil Brown <neilb@...e.de>, Al Viro <viro@...iv.linux.org.uk>,
	Christoph Hellwig <hch@....de>, linux-nfs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nfsd: fix NULL dereference in nfsd_statfs()

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@....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---
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ