[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1908211027430.1816-100000@iolanthe.rowland.org>
Date: Wed, 21 Aug 2019 10:30:10 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Roger Quadros <rogerq@...com>
cc: balbi@...nel.org, <gregkh@...uxfoundation.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [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@...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
Powered by blists - more mailing lists