Skip to content

Commit ba1b730

Browse files
committed
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
2 parents 294248e + 2531a0c commit ba1b730

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

security/smack/smack_lsm.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,9 +1545,9 @@ static int smack_inode_listsecurity(struct inode *inode, char *buffer,
15451545
*/
15461546
static void smack_inode_getsecid(struct inode *inode, u32 *secid)
15471547
{
1548-
struct inode_smack *isp = inode->i_security;
1548+
struct smack_known *skp = smk_of_inode(inode);
15491549

1550-
*secid = isp->smk_inode->smk_secid;
1550+
*secid = skp->smk_secid;
15511551
}
15521552

15531553
/*
@@ -4559,12 +4559,10 @@ static int smack_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)
45594559

45604560
static int smack_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
45614561
{
4562-
int len = 0;
4563-
len = smack_inode_getsecurity(inode, XATTR_SMACK_SUFFIX, ctx, true);
4562+
struct smack_known *skp = smk_of_inode(inode);
45644563

4565-
if (len < 0)
4566-
return len;
4567-
*ctxlen = len;
4564+
*ctx = skp->smk_known;
4565+
*ctxlen = strlen(skp->smk_known);
45684566
return 0;
45694567
}
45704568

0 commit comments

Comments
 (0)