Skip to content

Commit

Permalink
ceph: fix missing dput in ceph_set_acl
Browse files Browse the repository at this point in the history
Add matching dput() for d_find_alias().  Move d_find_alias() down a bit
at Julia's suggestion.

[ Introduced by commit 72466d0: "ceph: fix posix ACL hooks" ]

Reported-by: Fengguang Wu <[email protected]>
Reported-by: Julia Lawall <[email protected]>
Signed-off-by: Sage Weil <[email protected]>
Reviewed-by: Ilya Dryomov <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Sage Weil authored and torvalds committed Jan 31, 2014
1 parent e7651b8 commit 77516dc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/ceph/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
char *value = NULL;
struct iattr newattrs;
umode_t new_mode = inode->i_mode, old_mode = inode->i_mode;
struct dentry *dentry = d_find_alias(inode);
struct dentry *dentry;

if (acl) {
ret = posix_acl_valid(acl);
Expand Down Expand Up @@ -151,12 +151,13 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
goto out_free;
}

dentry = d_find_alias(inode);
if (new_mode != old_mode) {
newattrs.ia_mode = new_mode;
newattrs.ia_valid = ATTR_MODE;
ret = ceph_setattr(dentry, &newattrs);
if (ret)
goto out_free;
goto out_dput;
}

if (value)
Expand All @@ -170,11 +171,13 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
newattrs.ia_valid = ATTR_MODE;
ceph_setattr(dentry, &newattrs);
}
goto out_free;
goto out_dput;
}

ceph_set_cached_acl(inode, type, acl);

out_dput:
dput(dentry);
out_free:
kfree(value);
out:
Expand Down

0 comments on commit 77516dc

Please sign in to comment.