diff options
author | James Morris <james.morris@microsoft.com> | 2018-06-05 22:18:58 +0200 |
---|---|---|
committer | James Morris <james.morris@microsoft.com> | 2018-06-05 22:18:58 +0200 |
commit | 2531a0cd2dd9dc2b0da9fabb950e2db308ce78b8 (patch) | |
tree | 38657d8465750b7b091bb4cd2edb30a95a3b333e /security/smack | |
parent | dh key: get rid of stack allocated array for zeroes (diff) | |
parent | Smack: Fix memory leak in smack_inode_getsecctx (diff) | |
download | linux-2531a0cd2dd9dc2b0da9fabb950e2db308ce78b8.tar.xz linux-2531a0cd2dd9dc2b0da9fabb950e2db308ce78b8.zip |
Merge branch 'smack-for-4.18' of https://github.com/cschaufler/next-smack into next-smack
"one simple patch that fixes a memory leak in kernfs and labeled NFS"
Diffstat (limited to 'security/smack')
-rw-r--r-- | security/smack/smack_lsm.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index dcb976f98df2..7ad226018f51 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1545,9 +1545,9 @@ static int smack_inode_listsecurity(struct inode *inode, char *buffer, */ static void smack_inode_getsecid(struct inode *inode, u32 *secid) { - struct inode_smack *isp = inode->i_security; + struct smack_known *skp = smk_of_inode(inode); - *secid = isp->smk_inode->smk_secid; + *secid = skp->smk_secid; } /* @@ -4559,12 +4559,10 @@ static int smack_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) static int smack_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen) { - int len = 0; - len = smack_inode_getsecurity(inode, XATTR_SMACK_SUFFIX, ctx, true); + struct smack_known *skp = smk_of_inode(inode); - if (len < 0) - return len; - *ctxlen = len; + *ctx = skp->smk_known; + *ctxlen = strlen(skp->smk_known); return 0; } |