From: "Akinobu Mita" <akinobu.mita@gmail.com>
To: "Greg KH" <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org, "Rusty Russell" <rusty@rustcorp.com.au>
Subject: Re: [PATCH] module: return error when mod_sysfs_init() failed
Date: Sun, 30 Sep 2007 00:37:10 +0900 [thread overview]
Message-ID: <961aa3350709290837m2d9d6668gd68b7cb8ac11e4d4@mail.gmail.com> (raw)
In-Reply-To: <20070929145646.GB3075@suse.de>
2007/9/29, Greg KH <gregkh@suse.de>:
> > Index: 2.6-git/kernel/module.c
> > ===================================================================
> > --- 2.6-git.orig/kernel/module.c
> > +++ 2.6-git/kernel/module.c
> > @@ -1782,7 +1782,8 @@ static struct module *load_module(void _
> > module_unload_init(mod);
> >
> > /* Initialize kobject, so we can reference it. */
> > - if (mod_sysfs_init(mod) != 0)
> > + err = mod_sysfs_init(mod);
> > + if (err)
> > goto cleanup;
>
> I must be still asleep this morning, but I think this patch does the
> exact same thing as the original code does, right? Otherwise, this
> code would always be failing.
>
> Or do I just need to go get my morning coffee to wake up and see the
> problem here?
Hello,
In the original code, the "err" is zero before goto cleanup.
This "err" will be the return value of load_module().
load_module() is the function which returns error as pointer
and the expression IS_ERR(NULL) is false. So the caller of load_module()
cannot catch that error.
I found this problem when I was running the fault injection test
script in Documentation/fault-injection/fault-injection.txt with
random module.
#!/bin/bash
FAILTYPE=failslab
echo Y > /debug/$FAILTYPE/task-filter
echo 10 > /debug/$FAILTYPE/probability
echo 100 > /debug/$FAILTYPE/interval
echo -1 > /debug/$FAILTYPE/times
echo 0 > /debug/$FAILTYPE/space
echo 2 > /debug/$FAILTYPE/verbose
echo 0 > /debug/$FAILTYPE/ignore-gfp-wait
faulty_system()
{
bash -c "echo 1 > /proc/self/make-it-fail && exec $*"
}
if [ $# -eq 0 ]
then
echo "Usage: $0 modulename [ modulename ... ]"
exit 1
fi
for m in $*
do
echo inserting $m...
faulty_system modprobe $m
echo removing $m...
faulty_system modprobe -r $m
done
next prev parent reply other threads:[~2007-09-29 15:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-29 10:06 Akinobu Mita
2007-09-29 13:51 ` Rusty Russell
2007-09-29 14:56 ` Greg KH
2007-09-29 15:37 ` Akinobu Mita [this message]
2007-09-29 17:17 ` Greg KH
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=961aa3350709290837m2d9d6668gd68b7cb8ac11e4d4@mail.gmail.com \
--to=akinobu.mita@gmail.com \
--cc=gregkh@suse.de \
--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 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®