linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: <balbi@kernel.org>, <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: gadget: udc: core: Fix error case while binding pending gadget drivers
Date: Thu, 22 Aug 2019 16:37:39 +0300	[thread overview]
Message-ID: <9eba7e43-5692-b9c7-b30c-39a60e3239a6@ti.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1908211027430.1816-100000@iolanthe.rowland.org>



On 21/08/2019 17:30, Alan Stern wrote:
> 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.

OK. I'll send a revised patch to retain existing policy.

cheers,
-roger
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  reply	other threads:[~2019-08-22 13:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 10:12 [PATCH] usb: gadget: udc: core: Fix error case while binding pending gadget drivers Roger Quadros
2019-08-21 14:30 ` Alan Stern
2019-08-22 13:37   ` Roger Quadros [this message]
2019-08-22 13:40 ` [PATCH v2] usb: gadget: udc: core: Fix segfault if udc_bind_to_driver() for pending driver fails Roger Quadros
2019-08-22 14:43   ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9eba7e43-5692-b9c7-b30c-39a60e3239a6@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).