Re: [patchset] Lockfree fd lookup 2 of 5

Greg KH
2004-08-03T06:57:25Z

On Mon, Aug 02, 2004 at 03:46:06PM +0530, Ravikiran G Thirumalai wrote:
> diff -ruN -X dontdiff2 linux-2.6.7/drivers/usb/core/message.c kref-2.6.7/drivers/usb/core/message.c
> --- linux-2.6.7/drivers/usb/core/message.c 2004-06-16 10:49:02.000000000 +0530
> +++ kref-2.6.7/drivers/usb/core/message.c 2004-07-20 15:07:24.000000000 +0530
> @@ -1077,11 +1077,12 @@
>
> static void release_interface(struct device *dev)
> {
> + extern void destroy_serial(struct kref *kref);
> struct usb_interface *intf = to_usb_interface(dev);
> struct usb_interface_cache *intfc =
> altsetting_to_usb_interface_cache(intf->altsetting);
>
> - kref_put(&intfc->ref);
> + kref_put(&intfc->ref, destroy_serial);
> kfree(intf);
> }

This is the bug. destroy_serial() is for the usb_serial core and does
not clean up for this type of structure (and is not exported, so it will
not even build properly). Also, never put a function prototype within a
function like you did here.

So, I'm guessing you didn't try to remove any USB devices after applying
your patch? :)

thanks,

greg k-h