From: Jan Kara Date: Tue, 2 Jun 2015 15:08:29 +0000 (+0200) Subject: audit: Fix check of return value of strnlen_user() X-Git-Tag: v4.1.12-92~15^2~17 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a823f8f33615840e0f874282053a8884a3279ce0;p=users%2Fjedix%2Flinux-maple.git audit: Fix check of return value of strnlen_user() Orabug: 25308127 [ Upstream commit 0b08c5e59441d08ab4b5e72afefd5cd98a4d83df ] strnlen_user() returns 0 when it hits fault, not -1. Fix the test in audit_log_single_execve_arg(). Luckily this shouldn't ever happen unless there's a kernel bug so it's mostly a cosmetic fix. CC: Paul Moore Signed-off-by: Jan Kara Signed-off-by: Paul Moore Signed-off-by: Sasha Levin (cherry picked from commit a49b282f08d96cd73838e4e1a5ace747d432ba7d) Signed-off-by: Dhaval Giani --- diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 9fb9d1cb83ce2..bb947ceeee4d2 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -1023,7 +1023,7 @@ static int audit_log_single_execve_arg(struct audit_context *context, * for strings that are too long, we should not have created * any. */ - if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) { + if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) { WARN_ON(1); send_sig(SIGKILL, current, 0); return -1;