diff options
author | Serge Hallyn <serge@hallyn.com> | 2017-05-08 11:00:40 -0500 |
---|---|---|
committer | Serge Hallyn <serge@hallyn.com> | 2017-05-08 11:00:40 -0500 |
commit | 8135bafbb7384c4aaf14aa9439279cc180bfe759 (patch) | |
tree | 0a092404a0daaf8e8f08844ea75ad3379ca8d321 | |
parent | f81a3e94e0a6ba102df23b7e1495700741ed7cd4 (diff) | |
download | linux-security-2017-05-08/nsfscap.tar.gz |
cap_inode_getsecurity: drop dentry ref2017-05-08/nsfscap
Signed-off-by: Serge Hallyn <serge@hallyn.com>
-rw-r--r-- | security/commoncap.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index a1a2935cfb603..c28d1261e8053 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -402,15 +402,16 @@ int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer, return -EINVAL; size = sizeof(struct vfs_ns_cap_data); - ret = vfs_getxattr_alloc(dentry, XATTR_NAME_CAPS, + ret = (int) vfs_getxattr_alloc(dentry, XATTR_NAME_CAPS, &tmpbuf, size, GFP_NOFS); + dput(dentry); if (ret < 0) return ret; fs_ns = inode->i_sb->s_user_ns; cap = (struct vfs_cap_data *) tmpbuf; - if (is_v2header(ret, cap->magic_etc)) { + if (is_v2header((size_t) ret, cap->magic_etc)) { /* If this is sizeof(vfs_cap_data) then we're ok with the * on-disk value, so return that. */ if (alloc) @@ -418,7 +419,7 @@ int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer, else kfree(tmpbuf); return ret; - } else if (!is_v3header(ret, cap->magic_etc)) { + } else if (!is_v3header((size_t) ret, cap->magic_etc)) { kfree(tmpbuf); return -EINVAL; } |