lkml.org 
[lkml]   [2019]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: gadget: udc: core: Fix error case while binding pending gadget drivers
On Wed, 21 Aug 2019, Roger Quadros wrote:

> If binding a pending gadget driver fails we should not
> remove it from the pending driver list, otherwise it
> will cause a segmentation fault later when the gadget driver is
> unloaded.

> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> drivers/usb/gadget/udc/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index 7cf34beb50df..c272c8014772 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -1142,7 +1142,7 @@ static int check_pending_gadget_drivers(struct usb_udc *udc)
> if (!driver->udc_name || strcmp(driver->udc_name,
> dev_name(&udc->dev)) == 0) {
> ret = udc_bind_to_driver(udc, driver);
> - if (ret != -EPROBE_DEFER)
> + if (!ret)
> list_del(&driver->pending);
> break;
> }

This is kind of a policy question. If binding a pending gadget driver
fails, should the driver remain pending?

Depending on the answer to this question, you might want to change the
list_del to list_del_init. That should fix the segmentation fault
just as well.

Alan Stern

\
 
 \ /
  Last update: 2019-08-21 16:31    [W:0.084 / U:1.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site