diff options
author | Eric Biggers <ebiggers@google.com> | 2018-07-17 20:36:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-26 09:38:09 +0300 |
commit | 55bdb77aa991c2dfd107c4805e334ad571f73a4f (patch) | |
tree | 6cd831a3a93499f84b12db1d1b868b211a7d030d /security | |
parent | bdf948eaa5593f82bb3345e0432a5671091f487d (diff) | |
download | linux-55bdb77aa991c2dfd107c4805e334ad571f73a4f.tar.xz |
security: check for kstrdup() failure in lsm_append()
[ Upstream commit 87ea58433208d17295e200d56be5e2a4fe4ce7d6 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security')
-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 4bf0f571b4ef..95a1a0f52880 100644 --- a/security/security.c +++ b/security/security.c @@ -111,6 +111,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)) |