Commit db973a72 authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Linus Torvalds

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: 315c6926 ("coredump: split pipe command whitespace before expanding template")
Reported-by: default avatarMatthew Ruffell <>
Signed-off-by: default avatarSudip Mukherjee <>
Signed-off-by: default avatarAndrew Morton <>
Cc: Paul Wise <>
Cc: Alexander Viro <>
Cc: Neil Horman <>
Cc: <>
Link: default avatarLinus Torvalds <>
parent 94b7cc01
......@@ -211,6 +211,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm,
return -ENOMEM;
(*argv)[(*argc)++] = 0;
if (!(*pat_ptr))
return -ENOMEM;
/* Repeat as long as we have more pattern to process and more output
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment