aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-06-29 02:26:59 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-06-29 02:26:59 -0400
commita4859d75944a726533ab86d24bb5ffd1b2b7d6cc (patch)
tree1a1c97b15b21d90334b1ca0d0c47bae2cf0e2595
parent4c2e07c6a29e0129e975727b9f57eede813eea85 (diff)
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: 8d3095f4ad47 ("ovl: default permissions") Cc: <stable@vger.kernel.org> # v4.5+
-rw-r--r--fs/overlayfs/inode.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 1dbeab6cf96e..8514d692042b 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -121,16 +121,18 @@ int ovl_permission(struct inode *inode, int mask)
121 121
122 err = vfs_getattr(&realpath, &stat); 122 err = vfs_getattr(&realpath, &stat);
123 if (err) 123 if (err)
124 return err; 124 goto out_dput;
125 125
126 err = -ESTALE;
126 if ((stat.mode ^ inode->i_mode) & S_IFMT) 127 if ((stat.mode ^ inode->i_mode) & S_IFMT)
127 return -ESTALE; 128 goto out_dput;
128 129
129 inode->i_mode = stat.mode; 130 inode->i_mode = stat.mode;
130 inode->i_uid = stat.uid; 131 inode->i_uid = stat.uid;
131 inode->i_gid = stat.gid; 132 inode->i_gid = stat.gid;
132 133
133 return generic_permission(inode, mask); 134 err = generic_permission(inode, mask);
135 goto out_dput;
134 } 136 }
135 137
136 /* Careful in RCU walk mode */ 138 /* Careful in RCU walk mode */