Skip to content

Commit db973a7

Browse files
sudipm-mukherjeetorvalds
authored andcommitted
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: 315c692 ("coredump: split pipe command whitespace before expanding template") Reported-by: Matthew Ruffell <[email protected]> Signed-off-by: Sudip Mukherjee <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Paul Wise <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Neil Horman <[email protected]> Cc: <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 94b7cc0 commit db973a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/coredump.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm,
211211
return -ENOMEM;
212212
(*argv)[(*argc)++] = 0;
213213
++pat_ptr;
214+
if (!(*pat_ptr))
215+
return -ENOMEM;
214216
}
215217

216218
/* Repeat as long as we have more pattern to process and more output

0 commit comments

Comments
 (0)