mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
security: check for kstrdup() failure in lsm_append()
[ Upstream commit87ea584332
] lsm_append() should return -ENOMEM if memory allocation failed. Fixes:d69dece5f5
("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>
This commit is contained in:
parent
bdf948eaa5
commit
55bdb77aa9
1 changed files with 2 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue