Re: [PATCH] usb: core: endpoint: Fix error path

From: Ming Lei
Date: Sat Oct 02 2010 - 06:28:59 EST


2010/10/2 Rahul Ruikar <rahul.ruikar@xxxxxxxxx>:
> Thanks Ming.
> I have certain doubts related to device_unregister()
>
> In some of USB related code..
> kfree() is called after device_unregister() ...  device_unregister()
> also internally calls put_device()... is that correct behavior or I'm
> missing something here..

If no other external reference to device before put_device in device_unregister,
dev.release will be called from put_device to free something, which depends
on your implement for dev.release.

> ex.
> file : drivers/usb/gadget/fsl_udc_core.c
> function : static int __init fsl_udc_probe(struct platform_device *pdev)

Once reaches err_unregister, double free of udc_controller may be
triggered, so fix should be needed.

--
Lei Ming
--
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/