* [PATCH] security: check for kstrdup() failure in lsm_append()
@ 2018-07-17 17:36 Eric Biggers
2018-07-18 4:28 ` James Morris
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2018-07-17 17:36 UTC (permalink / raw)
To: linux-security-module
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>
---
security/security.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/security/security.c b/security/security.c
index 03e98be76d58..259ff593d543 100644
--- a/security/security.c
+++ b/security/security.c
@@ -121,6 +121,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))
--
2.18.0.203.gfac676dfb9-goog
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH] security: check for kstrdup() failure in lsm_append()
2018-07-17 17:36 [PATCH] security: check for kstrdup() failure in lsm_append() Eric Biggers
@ 2018-07-18 4:28 ` James Morris
0 siblings, 0 replies; 2+ messages in thread
From: James Morris @ 2018-07-18 4:28 UTC (permalink / raw)
To: linux-security-module
On Tue, 17 Jul 2018, Eric Biggers wrote:
> 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>
> ---
> security/security.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/security/security.c b/security/security.c
> index 03e98be76d58..259ff593d543 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -121,6 +121,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))
>
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general
--
James Morris
<jmorris@namei.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-18 4:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-17 17:36 [PATCH] security: check for kstrdup() failure in lsm_append() Eric Biggers
2018-07-18 4:28 ` James Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox