mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: oleg@redhat.com, viro@zeniv.linux.org.uk, rostedt@goodmis.org,
	fweisbec@gmail.com, mingo@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kmod: Check for NULL at call_usermodehelper_exec().
Date: Mon, 23 Sep 2013 14:30:57 -0700	[thread overview]
Message-ID: <20130923143057.a6a7ac7d524f890bfef92b72@linux-foundation.org> (raw)
In-Reply-To: <201309240612.ADE82877.MSFHVtOOFLFOQJ@I-love.SAKURA.ne.jp>

On Tue, 24 Sep 2013 06:12:34 +0900 Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> wrote:

> Andrew, would you pick up this patch?
> 
> Regards.
> ----------
> >From d6ff218545060c5f8b75b15d5b34bffcf625508f Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Mon, 16 Sep 2013 02:19:10 +0900
> Subject: [PATCH] kmod: Check for NULL at call_usermodehelper_exec().
> 
> If /proc/sys/kernel/core_pattern contains only "|", NULL pointer dereference
> happens upon core dump because argv_split("") returns argv[0] == NULL.
> 
> This bug was once fixed by commit 264b83c0 "usermodehelper: check
> subprocess_info->path != NULL" but was by error reintroduced by commit
> 7f57cfa4 "usermodehelper: kill the sub_info->path[0] check".
> 
> This bug seems to exist since 2.6.19 (the version which core dump to pipe was
> added). Depending on kernel version and config, some side effect might happen
> immediately after this oops (e.g. kernel panic with 2.6.32-358.18.1.el6).
> 
> ...
>
> --- a/kernel/kmod.c
> +++ b/kernel/kmod.c
> @@ -571,6 +571,10 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
>  	DECLARE_COMPLETION_ONSTACK(done);
>  	int retval = 0;
>  
> +	if (!sub_info->path) {
> +		call_usermodehelper_freeinfo(sub_info);
> +		return -ENOENT;
> +	}
>  	helper_lock();
>  	if (!khelper_wq || usermodehelper_disabled) {
>  		retval = -EBUSY;

The error is that the user put a bare "|" into
/proc/sys/kernel/core_pattern.  Is ENOENT ("No such file or directory")
the most appropriate error code here?  I think EINVAL ("Invalid
argument")?


  reply	other threads:[~2013-09-23 21:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-14  7:32 [PATCH] argv_split: Return NULL if argument contains no non-whitespace Tetsuo Handa
2013-09-14 15:41 ` Oleg Nesterov
2013-09-15  0:10   ` [PATCH] argv_split: Return NULL if argument contains nonon-whitespace Tetsuo Handa
2013-09-15 14:23     ` [PATCH] kmod: Check for NULL at call_usermodehelper_exec() Tetsuo Handa
2013-09-15 16:31       ` Oleg Nesterov
2013-09-15 17:02         ` Tetsuo Handa
2013-09-15 17:15           ` Oleg Nesterov
2013-09-15 17:26             ` Tetsuo Handa
2013-09-15 17:34               ` Oleg Nesterov
2013-09-23 21:12               ` Tetsuo Handa
2013-09-23 21:30                 ` Andrew Morton [this message]
2013-09-24 14:58                   ` Tetsuo Handa
2013-09-15 16:26     ` [PATCH] argv_split: Return NULL if argument contains nonon-whitespace Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130923143057.a6a7ac7d524f890bfef92b72@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rostedt@goodmis.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®