All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kenneth Lee <kenlee@dg.gov.cn>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: [Patch] kernel: bug fixing for kernel/kmod.c
Date: Wed, 2 Aug 2006 22:30:46 +0800	[thread overview]
Message-ID: <20060802143046.GA5645@kenny> (raw)

I think there is a bug in kmod.c: In __call_usermodehelper(), when 
kernel_thread(wait_for_helper, ...) return success, since
wait_for_helper() might call complete() at any time, the sub_info should
not be used any more.

Normally wait_for_helper() take a long time to finish, you may not get 
problem for most of the case. But if you remove /sbin/modprobe, it may
become easier for you to get a oop in khelper.

the following patch is made in 2.6.17.7

--- linux-2.6.17.7/kernel/kmod.c.orig   2006-08-02 22:13:21.805902750
+0800
+++ linux-2.6.17.7/kernel/kmod.c        2006-08-02 22:15:36.946348500
+0800
@@ -198,6 +198,7 @@ static void __call_usermodehelper(void *
 {
        struct subprocess_info *sub_info = data;
        pid_t pid;
+       int wait = sub_info->wait;

        /* CLONE_VFORK: wait until the usermode helper has execve'd
         * successfully We need the data structures to stay around
@@ -212,7 +213,7 @@ static void __call_usermodehelper(void *
        if (pid < 0) {
                sub_info->retval = pid;
                complete(sub_info->complete);
-       } else if (!sub_info->wait)
+       } else if (!wait)
                complete(sub_info->complete);
 }

-- 

             reply	other threads:[~2006-08-02 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-02 14:30 Kenneth Lee [this message]
2006-08-02 14:42 ` [Patch] kernel: bug fixing for kernel/kmod.c Kenneth Lee
2006-08-03  1:52 ` Matt Helsley
  -- strict thread matches above, loose matches on Subject: below --
2006-08-01 17:20 kenny
2006-08-01 18:15 ` Steven Rostedt

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=20060802143046.GA5645@kenny \
    --to=kenlee@dg.gov.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.