diff options
author | Eric Biggers <ebiggers@google.com> | 2018-07-17 19:36:04 +0200 |
---|---|---|
committer | James Morris <james.morris@microsoft.com> | 2018-07-18 06:27:06 +0200 |
commit | 87ea58433208d17295e200d56be5e2a4fe4ce7d6 (patch) | |
tree | 923d0e0a46960ca912f279e6c16bf758c6217d86 /security/security.c | |
parent | security: export security_kernel_load_data function (diff) | |
download | linux-87ea58433208d17295e200d56be5e2a4fe4ce7d6.tar.xz linux-87ea58433208d17295e200d56be5e2a4fe4ce7d6.zip |
security: check for kstrdup() failure in lsm_append()
lsm_append() should return -ENOMEM if memory allocation failed.
Fixes: d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c index 6e149d0ffe33..b49ee810371b 100644 --- a/security/security.c +++ b/security/security.c @@ -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)) |