mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH master 1/3] usb: gadget: multi: do not double free on error
Date: Wed, 26 Jul 2023 15:32:39 +0200	[thread overview]
Message-ID: <20230726133239.GV18491@pengutronix.de> (raw)
In-Reply-To: <20230707121354.3248365-1-a.fatoum@pengutronix.de>

On Fri, Jul 07, 2023 at 02:13:52PM +0200, Ahmad Fatoum wrote:
> Recent sync with kernel changed usb_composite_probe to free resources on
> error as expected, so calling usb_composite_unregister on failed probe
> is now a double free. Fix that.
> 
> Fixes: 14211ab8b0e1 ("usb: gadget: Update core to Linux-6.3-rc2")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/usb/gadget/legacy/multi.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c
> index 7046a529b1db..ddb3d4158cd7 100644
> --- a/drivers/usb/gadget/legacy/multi.c
> +++ b/drivers/usb/gadget/legacy/multi.c
> @@ -294,10 +294,8 @@ int usb_multi_register(struct f_multi_opts *opts)
>  	gadget_multi_opts = opts;
>  
>  	ret = usb_composite_probe(&multi_driver);
> -	if (ret) {
> -		usb_composite_unregister(&multi_driver);
> +	if (ret)
>  		gadget_multi_opts = NULL;
> -	}
>  
>  	return ret;
>  }
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      parent reply	other threads:[~2023-07-26 13:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 12:13 Ahmad Fatoum
2023-07-07 12:13 ` [PATCH master 2/3] commands: usbserial: prevent double free Ahmad Fatoum
2023-07-07 12:13 ` [PATCH master 3/3] usb: gadget: return error on missing UDC Ahmad Fatoum
2023-07-26 13:32 ` Sascha Hauer [this message]

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=20230726133239.GV18491@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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