aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorGu Zheng <guzheng1@huawei.com>2017-01-09 09:34:48 +0800
committerMoyster <oysterized@gmail.com>2017-06-17 15:45:35 +0200
commit41f4de62e9e9c5cbb4ff2a1cf469eb15c409eb38 (patch)
treece5963782aa7f3d0e2cbc540cffe4e167fc73a47 /fs
parente11a5f0cc74c8b0f8add083aea0535cf66681a1b (diff)
tmpfs: : fix a potential acl leak
Diffstat (limited to 'fs')
-rw-r--r--fs/generic_acl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/generic_acl.c b/fs/generic_acl.c
index 21408084c..451654d6d 100644
--- a/fs/generic_acl.c
+++ b/fs/generic_acl.c
@@ -82,14 +82,19 @@ generic_acl_set(struct dentry *dentry, const char *name, const void *value,
return PTR_ERR(acl);
}
if (acl) {
+ struct posix_acl *old_acl;
+
error = posix_acl_valid(acl);
if (error)
goto failed;
switch (type) {
case ACL_TYPE_ACCESS:
+ old_acl = acl;
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
if (error)
goto failed;
+ if (!acl)
+ posix_acl_release(old_acl);
inode->i_ctime = CURRENT_TIME;
break;
case ACL_TYPE_DEFAULT: