summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 15:57:04 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 15:57:04 -0700
commitba1b7309fc2e909a5828c36a7cd187e5d7df6f53 (patch)
treee1d65408b3be4a85db47c5d4507dc5e52b997a1b /security
parent294248e9fb46cb1342ac18fc2fb5fad0b7e3b3b1 (diff)
parent2531a0cd2dd9dc2b0da9fabb950e2db308ce78b8 (diff)
downloadlinux-ba1b7309fc2e909a5828c36a7cd187e5d7df6f53.tar.gz
linux-ba1b7309fc2e909a5828c36a7cd187e5d7df6f53.tar.bz2
linux-ba1b7309fc2e909a5828c36a7cd187e5d7df6f53.zip
Merge branch 'next-smack' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull smack update from James Morris: "From Casey: One simple patch that fixes a memory leak in kernfs and labeled NFS" * 'next-smack' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: Smack: Fix memory leak in smack_inode_getsecctx
Diffstat (limited to 'security')
-rw-r--r--security/smack/smack_lsm.c12
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;
}