diff options
author | José Bollo <jose.bollo@open.eurogiciel.org> | 2014-01-08 15:53:05 +0100 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@open.eurogiciel.org> | 2015-02-04 11:23:19 +0100 |
commit | 5553a84615553a4691ebb0fc27feac81d3e77810 (patch) | |
tree | 3f9a369b382660d3e9b3d40b252be6a1d4e00eeb /security | |
parent | 4077bbc2c5ee873a67f808b4a0ca06213e4ed570 (diff) | |
download | linux-stable-5553a84615553a4691ebb0fc27feac81d3e77810.tar.gz linux-stable-5553a84615553a4691ebb0fc27feac81d3e77810.tar.bz2 linux-stable-5553a84615553a4691ebb0fc27feac81d3e77810.zip |
Minor improvement of 'smack_sb_kern_mount'
Fix a possible memory access fault when transmute is true and isp is NULL.
Change-Id: I29708ce54b96b34b440cf349e2b1891ea8d9d34f
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/smack/smack_lsm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index c972a71c8d7f..816e785bf51b 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; |