From: José Bollo Date: Wed, 8 Jan 2014 14:53:05 +0000 (+0100) Subject: Minor improvement of 'smack_sb_kern_mount' X-Git-Tag: firefly_0821_release~176^2~2675^2~46^2~10 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=55dfc5da1a9b7e623b6f35620c74280555df0288;p=firefly-linux-kernel-4.4.55.git Minor improvement of 'smack_sb_kern_mount' Fix a possible memory access fault when transmute is true and isp is NULL. Signed-off-by: José Bollo --- diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index d814e35987be..efa42991235e 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;