Commit 55bdb77a authored by Eric Biggers's avatar Eric Biggers Committed by Greg Kroah-Hartman

security: check for kstrdup() failure in lsm_append()

[ Upstream commit 87ea5843 ]

lsm_append() should return -ENOMEM if memory allocation failed.

Fixes: d69dece5 ("LSM: Add /sys/kernel/security/lsm")
Signed-off-by: default avatarEric Biggers <>
Signed-off-by: default avatarJames Morris <>
Signed-off-by: default avatarSasha Levin <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent bdf948ea
......@@ -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))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment