]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
LSM: fix return value check in safesetid_init_securityfs()
authorWei Yongjun <weiyongjun1@huawei.com>
Tue, 12 Feb 2019 07:58:31 +0000 (07:58 +0000)
committerJames Morris <james.morris@microsoft.com>
Tue, 12 Feb 2019 18:59:22 +0000 (10:59 -0800)
In case of error, the function securityfs_create_dir() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: aeca4e2ca65c ("LSM: add SafeSetID module that gates setid calls")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: James Morris <james.morris@microsoft.com>
security/safesetid/securityfs.c

index 61be4ee459cc23120ed47630f9cfb4491ab7391a..2c6c829be044dd70032c50039084ad984e4dc87a 100644 (file)
@@ -167,7 +167,7 @@ static int __init safesetid_init_securityfs(void)
                return 0;
 
        safesetid_policy_dir = securityfs_create_dir("safesetid", NULL);
-       if (!safesetid_policy_dir) {
+       if (IS_ERR(safesetid_policy_dir)) {
                ret = PTR_ERR(safesetid_policy_dir);
                goto error;
        }