[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200428182245.549168975@linuxfoundation.org>
Date: Tue, 28 Apr 2020 20:24:38 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Matthew Ruffell <matthew.ruffell@...onical.com>,
Sudip Mukherjee <sudipm.mukherjee@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Paul Wise <pabs3@...edaddy.net>,
Alexander Viro <viro@...iv.linux.org.uk>,
Neil Horman <nhorman@...driver.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH 5.4 104/168] coredump: fix null pointer dereference on coredump
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
commit db973a7289dad24e6c017dcedc6aee886579dc3a upstream.
If the core_pattern is set to "|" and any process segfaults then we get
a null pointer derefernce while trying to coredump. The call stack shows:
RIP: do_coredump+0x628/0x11c0
When the core_pattern has only "|" there is no use of trying the
coredump and we can check that while formating the corename and exit
with an error.
After this change I get:
format_corename failed
Aborting core
Fixes: 315c69261dd3 ("coredump: split pipe command whitespace before expanding template")
Reported-by: Matthew Ruffell <matthew.ruffell@...onical.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@...il.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Cc: Paul Wise <pabs3@...edaddy.net>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Neil Horman <nhorman@...driver.com>
Cc: <stable@...r.kernel.org>
Link: http://lkml.kernel.org/r/20200416194612.21418-1-sudipm.mukherjee@gmail.com
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/coredump.c | 2 ++
1 file changed, 2 insertions(+)
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -211,6 +211,8 @@ static int format_corename(struct core_n
return -ENOMEM;
(*argv)[(*argc)++] = 0;
++pat_ptr;
+ if (!(*pat_ptr))
+ return -ENOMEM;
}
/* Repeat as long as we have more pattern to process and more output
Powered by blists - more mailing lists