summaryrefslogtreecommitdiff
path: root/security/smack
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2013-05-27 15:11:27 +0400
committerCasey Schaufler <casey@schaufler-ca.com>2013-05-28 21:15:35 +0400
commit8cd77a0bd4b4a7d02c2a6926a69585d8088ee721 (patch)
treed74853403421414232b56b9f0d7e61a1733c6bf9 /security/smack
parente830b39412ca2bbedd7508243f21c04d57ad543c (diff)
downloadlinux-8cd77a0bd4b4a7d02c2a6926a69585d8088ee721.tar.xz
Smack: Fix possible NULL pointer dereference at smk_netlbl_mls()
netlbl_secattr_catmap_alloc(GFP_ATOMIC) can return NULL. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Diffstat (limited to 'security/smack')
-rw-r--r--security/smack/smack_access.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c
index 53f2327a592f..6a0377f38620 100644
--- a/security/smack/smack_access.c
+++ b/security/smack/smack_access.c
@@ -403,6 +403,8 @@ int smk_netlbl_mls(int level, char *catset, struct netlbl_lsm_secattr *sap,
sap->flags |= NETLBL_SECATTR_MLS_CAT;
sap->attr.mls.lvl = level;
sap->attr.mls.cat = netlbl_secattr_catmap_alloc(GFP_ATOMIC);
+ if (!sap->attr.mls.cat)
+ return -ENOMEM;
sap->attr.mls.cat->startbit = 0;
for (cat = 1, cp = catset, byte = 0; byte < len; cp++, byte++)