diff options
author | José Bollo <jose.bollo@open.eurogiciel.org> | 2014-01-08 15:53:05 +0100 |
---|---|---|
committer | Damian Hobson-Garcia <dhobsong@igel.co.jp> | 2014-12-11 16:53:24 +0900 |
commit | d273010b26b49e3e2b12a6b422f7c94a26d61396 (patch) | |
tree | 09860cb3b6ab2267790d5424036026b1e9579df2 | |
parent | bd6515226a237a57458c315726d0ca7b28e1e5da (diff) | |
download | renesas_kernel-d273010b26b49e3e2b12a6b422f7c94a26d61396.tar.gz renesas_kernel-d273010b26b49e3e2b12a6b422f7c94a26d61396.tar.bz2 renesas_kernel-d273010b26b49e3e2b12a6b422f7c94a26d61396.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>
(cherry picked from commit c2d41b31fc60b8592c220d27f425a8214f473a90)
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-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 c972a71c8d7..816e785bf51 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; |