ovl: fix dentry leak for default_permissions

When using the 'default_permissions' mount option, ovl_permission() on
non-directories was missing a dput(alias), resulting in "BUG Dentry still
in use".

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 8d3095f4ad ("ovl: default permissions")
Cc: <stable@vger.kernel.org> # v4.5+
This commit is contained in:
Miklos Szeredi 2016-06-29 08:26:59 +02:00
parent 4c2e07c6a2
commit a4859d7594
1 changed files with 5 additions and 3 deletions

View File

@ -121,16 +121,18 @@ int ovl_permission(struct inode *inode, int mask)
err = vfs_getattr(&realpath, &stat); err = vfs_getattr(&realpath, &stat);
if (err) if (err)
return err; goto out_dput;
err = -ESTALE;
if ((stat.mode ^ inode->i_mode) & S_IFMT) if ((stat.mode ^ inode->i_mode) & S_IFMT)
return -ESTALE; goto out_dput;
inode->i_mode = stat.mode; inode->i_mode = stat.mode;
inode->i_uid = stat.uid; inode->i_uid = stat.uid;
inode->i_gid = stat.gid; inode->i_gid = stat.gid;
return generic_permission(inode, mask); err = generic_permission(inode, mask);
goto out_dput;
} }
/* Careful in RCU walk mode */ /* Careful in RCU walk mode */