Re: [PATCH] vfs: fsmount: add missing mntget()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 12, 2019 at 11:43:13AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@xxxxxxxxxx>
> 
> sys_fsmount() needs to take a reference to the new mount when adding it
> to the anonymous mount namespace.  Otherwise the filesystem can be
> unmounted while it's still in use, as found by syzkaller.
> 
> Reported-by: Mark Rutland <mark.rutland@xxxxxxx>
> Reported-by: syzbot+99de05d099a170867f22@xxxxxxxxxxxxxxxxxxxxxxxxx
> Reported-by: syzbot+7008b8b8ba7df475fdc8@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 93766fbd2696 ("vfs: syscall: Add fsmount() to create a mount for a superblock")
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
>  fs/namespace.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index b26778bdc236e..5dc137a22d406 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -3445,6 +3445,7 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags,
>  	ns->root = mnt;
>  	ns->mounts = 1;
>  	list_add(&mnt->mnt_list, &ns->list);
> +	mntget(newmount.mnt);
>  
>  	/* Attach to an apparent O_PATH fd with a note that we need to unmount
>  	 * it, not just simply put it.

Nice catch...  Applied, with apologies for having been MIA lately.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux