summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2015-06-02 17:08:29 +0200
committerSasha Levin <alexander.levin@verizon.com>2016-08-19 23:07:58 -0400
commita49b282f08d96cd73838e4e1a5ace747d432ba7d (patch)
tree4962debc43d339c965b9241649884e0cf0218625 /kernel
parentdd265663a1a9a14d80ea34d9bde9b15d7b614bd2 (diff)
audit: Fix check of return value of strnlen_user()
[ 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 <pmoore@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/auditsc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 9fb9d1cb83ce..bb947ceeee4d 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;