From 6a4924d6679df181c202866edf61680e47ebacb3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Wed, 8 Jan 2014 15:53:05 +0100 Subject: [PATCH] Minor improvement of 'smack_sb_kern_mount' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix a possible memory access fault when transmute is true and isp is NULL. Change-Id: Ib922cfec405067ec5592880c4ae447969ba96633 Signed-off-by: José Bollo --- security/smack/smack_lsm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index acd8574..0589dee 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -413,9 +413,11 @@ static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) * Initialize the root inode. */ isp = inode->i_security; - if (inode->i_security == NULL) { - inode->i_security = new_inode_smack(sp->smk_root); - isp = inode->i_security; + if (isp == NULL) { + isp = new_inode_smack(sp->smk_root); + if (isp == NULL) + return -ENOMEM; + inode->i_security = isp; } else isp->smk_inode = sp->smk_root; -- 2.7.4