Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87ea5843 authored by Eric Biggers's avatar Eric Biggers Committed by James Morris
Browse files

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



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

Fixes: d69dece5 ("LSM: Add /sys/kernel/security/lsm")
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarJames Morris <james.morris@microsoft.com>
parent 83a68a06
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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))