]> Git Repo - linux.git/commitdiff
security: check for kstrdup() failure in lsm_append()
authorEric Biggers <[email protected]>
Tue, 17 Jul 2018 17:36:04 +0000 (10:36 -0700)
committerJames Morris <[email protected]>
Wed, 18 Jul 2018 04:27:06 +0000 (21:27 -0700)
lsm_append() should return -ENOMEM if memory allocation failed.

Fixes: d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm")
Signed-off-by: Eric Biggers <[email protected]>
Signed-off-by: James Morris <[email protected]>
security/security.c

index 6e149d0ffe333934c9efb628183df7f40082990d..b49ee810371bee5891f9ebe5fc2f091f1fe2e442 100644 (file)
@@ -118,6 +118,8 @@ static int lsm_append(char *new, char **result)
 
        if (*result == NULL) {
                *result = kstrdup(new, GFP_KERNEL);
+               if (*result == NULL)
+                       return -ENOMEM;
        } else {
                /* Check if it is the last registered name */
                if (match_last_lsm(*result, new))
This page took 0.056716 seconds and 4 git commands to generate.