From patchwork Wed Mar 3 09:18:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: 2.6.33 dies on modprobe Date: Tue, 02 Mar 2010 23:18:45 -0000 From: WANG Cong X-Patchwork-Id: 46785 Message-Id: <2375c9f91003030118x144a47d3n1dd5a08e88c144d3@mail.gmail.com> To: =?UTF-8?Q?Am=C3=A9rico_Wang?= , linux-kernel@vger.kernel.org, Linux Kernel Network Developers Cc: Greg Kroah-Hartman On Wed, Mar 3, 2010 at 5:08 PM, Américo Wang wrote: > On Wed, Mar 3, 2010 at 4:58 PM, Américo Wang wrote: >> On Mon, Mar 1, 2010 at 5:07 PM, M G Berberich >> wrote: >>> Hello, >>> >>> Am Montag, den 01. März schrieb Américo Wang: >>>> On Mon, Mar 1, 2010 at 6:12 AM, M G Berberich >>>> wrote: >>> >>>> > I tried to build a 2.6.33 kernel but on boot it dies on modprobe >>>> > (kernel-Oops). This might be the result of faulty config, but I'm >>>> > totaly clueless what's the fault. >>>> > >>>> > The kernel starts up fine and mounts the root-filesystem, but then >>>> > dies on the first modprobe executed. I can boot it with init=/bin/bash >>>> > and get a working bash (until I do modprobe on any module). >>>> > >>>> > System is a Gigabyte M55S-S3 rev 2.0 (nForce 550) with an AMD Athlon64 >>>> > X2 5000+ and amd64-kernel architecture. kernel-sources are from >>>> > kernel.org. >>> >>>> It seems something is wrong with forcedeth code or PCI code. >>>> Adding some Cc's. >>> >>> I don't think it's forcedeth. forcedeth just happens to be the first >>> module that get's loaded in startup. It crashes with any other module >>> too (I tried ohci_hcd). >>> >> >> Ok, below is my patch, I am not sure it could fix the BUG for you, >> but it could fix the WARNING. But perhaps they are related. >> >> Please give it a try. >> > > Oops! Ignore the patch, it should not be correct, I will send a > correct version soon. > Sorry. > Here we go: ---------------------> It looks really odd that we do class_put() in non-failure path of __class_register(). This seems wrong. To fix this, just remove class_get() in __class_register(), we don't need to call class_get() to get ref of cls->p->class_subsys, because kset_register() has already done this for us. Signed-off-by: WANG Cong Cc: Greg Kroah-Hartman diff --git a/drivers/base/class.c b/drivers/base/class.c index 6e2c3b0..695d624 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -191,8 +191,7 @@ int __class_register(struct class *cls, struct lock_class_key *key) kfree(cp); return error; } - error = add_class_attrs(class_get(cls)); - class_put(cls); + error = add_class_attrs(cls); return error; } EXPORT_SYMBOL_GPL(__class_register);