]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
do_coredump(): check return from argv_split()
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Tue, 6 Jan 2009 22:41:11 +0000 (14:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Jan 2009 23:59:14 +0000 (15:59 -0800)
do_coredump() accesses helper_argv[0] without checking helper_argv !=
NULL.  This can happen if page allocation failed.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/exec.c

index 6ca4e3d22a3d62663f28a8ae2c7e2fbacf197154..6b09d6fa4f7e1d66718735c9b6d1d282f9d16043 100644 (file)
--- 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)