Re: rmmod uhci_hcd -> BUG: atomic counter underflow

From: Greg KH
Date: Mon Mar 12 2007 - 17:43:51 EST


On Mon, Mar 12, 2007 at 05:25:09PM -0400, Alan Stern wrote:
> On Mon, 12 Mar 2007, Jiri Slaby wrote:
>
> > Jiri Slaby napsal(a):
> > > Alan Stern napsal(a):
> > >> On Mon, 12 Mar 2007, Jiri Slaby wrote:
> > >>> After rmmoding of uhci_hcd on fresh booted 2.6.21-rc3-mm2 I got this:
> > >>>
> > >>> BUG: atomic counter underflow at:
> > > [...]
> > >>> [<c01db754>] kobject_put+0x14/0x16
> > >>> [<c01db8a3>] kobject_unregister+0x22/0x25
> > >>> [<c024c987>] bus_remove_driver+0x75/0x82
> > >>> [<c024d3b8>] driver_unregister+0xb/0x18
> > >>> [<c01e7020>] pci_unregister_driver+0x13/0x73
> > >>> [<f88dbbd9>] uhci_hcd_cleanup+0xd/0x2d [uhci_hcd]
> > > [...]
> > >> Would it be possible for you to add the atomic counter underflow check
> > >> to 2.6.21-rc3 and see if the problem still occurs? If it doesn't,
> > >> that's a good indication the USB stack isn't guilty -- the bus
> > >> registration code hasn't changed for several kernel releases.
> > >
> > > Yes.
> >
> > I can confirm, that this issue went upstream and is currently present there.
>
> I found the problem, but I don't know how to fix it. Hopefully Greg or
> Rusty will know.
>
> There are two bugs in kernel/module.c:module_remove_driver(), right at the
> end of the routine:
>
> /*
> * Undo the additional reference we added in module_add_driver()
> * via kset_find_obj()
> */
> if (drv->mod_name)
> kobject_put(&drv->kobj);
>

This code is reverted in 2.6.21-rc3-git7 as it was incorrect as you have
properly determined.

So, can people please test with a kernel newer than that?

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/