summaryrefslogtreecommitdiffstats
path: root/security/safesetid
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2019-02-12 08:58:31 +0100
committerJames Morris <james.morris@microsoft.com>2019-02-12 19:59:22 +0100
commite7a44cfd639945a0dec749f896adc1d340c2a6aa (patch)
treef89795ae1dc53a5d41afe349291fb1176ea58473 /security/safesetid
parentLSM: SafeSetID: add selftest (diff)
downloadlinux-e7a44cfd639945a0dec749f896adc1d340c2a6aa.tar.xz
linux-e7a44cfd639945a0dec749f896adc1d340c2a6aa.zip
LSM: fix return value check in safesetid_init_securityfs()
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>
Diffstat (limited to 'security/safesetid')
-rw-r--r--security/safesetid/securityfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/safesetid/securityfs.c b/security/safesetid/securityfs.c
index 61be4ee459cc..2c6c829be044 100644
--- a/security/safesetid/securityfs.c
+++ b/security/safesetid/securityfs.c
@@ -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;
}