Sudip Mukherjee db973a7289 coredump: fix null pointer dereference on coredump
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@canonical.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Wise <pabs3@bonedaddy.net>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20200416194612.21418-1-sudipm.mukherjee@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-04-21 11:11:56 -07:00
..
2020-03-27 09:29:56 +00:00
2019-09-19 09:42:37 -07:00
2020-03-31 12:58:36 -07:00
2020-02-17 21:08:37 -08:00
2019-11-11 09:21:59 -05:00
2020-04-07 13:48:26 -07:00
2020-02-13 09:16:07 +01:00
2020-04-08 21:37:18 -07:00
2019-09-19 09:42:37 -07:00
2020-02-05 05:28:20 +00:00
\n
2020-01-30 15:37:41 -08:00
2020-04-10 15:36:22 -07:00
2019-09-19 09:42:37 -07:00
2020-01-14 13:28:28 -08:00
2020-04-02 12:59:36 -07:00
2019-08-07 21:51:47 -04:00
2020-02-07 14:48:35 -05:00
2020-02-07 14:48:35 -05:00
2020-03-06 11:06:15 +01:00
2020-02-08 13:44:41 -08:00
2020-03-05 21:00:40 -05:00
2020-03-05 21:00:40 -05:00
2020-04-06 10:38:59 -04:00
2020-03-12 17:33:11 -07:00
2020-03-02 14:04:31 -07:00
2019-12-08 14:37:36 +01:00