From: Tetsuo Handa Date: Tue, 6 Jan 2009 22:41:11 +0000 (-0800) Subject: do_coredump(): check return from argv_split() X-Git-Tag: firefly_0821_release~16261 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=350eaf791bebccb9ad5999351f3e328319545f03;p=firefly-linux-kernel-4.4.55.git do_coredump(): check return from argv_split() do_coredump() accesses helper_argv[0] without checking helper_argv != NULL. This can happen if page allocation failed. Signed-off-by: Tetsuo Handa Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/exec.c b/fs/exec.c index 6ca4e3d22a3d..6b09d6fa4f7e 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1770,6 +1770,11 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) if (ispipe) { helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc); + if (!helper_argv) { + printk(KERN_WARNING "%s failed to allocate memory\n", + __func__); + goto fail_unlock; + } /* Terminate the string before the first option */ delimit = strchr(corename, ' '); if (delimit)