security: check for kstrdup() failure in lsm_append()
PATCH 1/1 security: check for kstrdup() failure in lsm_append()
lsm_append() should return -ENOMEM if memory allocation failed.
Fixes d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm")
Signed-off-by Eric Biggers <[email protected]>
--- security/security.c | 2 ++ 1 file changed, 2 insertions(+)
security/security.c +2 -0
@@ -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))
Signature · 6 lines
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
James Morris
maintainerPATCH 1/1 security: check for kstrdup() failure in lsm_append()
Quoted 14 lines · Eric Biggers
lsm_append()should return-ENOMEMif memory allocation failed.Fixes d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm")Signed-off-by Eric Biggers <[email protected]>--- security/security.c | 2 ++ 1 file changed, 2 insertions(+)security/security.c +0
-0
security/security.c static int lsm_append(char *new, char **result) · line 128
Quoted 8 lines
security/security.c +2
-0@@ -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 togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general
Signature · 7 lines
James Morris <[email protected]> -- 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