On Sun, 7 May 2017, Anton Bondarenko wrote:

> Free memory allocated for address0_mutex if allocation of bandwidth_mutex
> failed.
> 
> Fixes: feb26ac31a2a ("usb: core: hub: hub_port_init lock controller instead 
> of bus")
> 
> Signed-off-by: Anton Bondarenko <anton.bondarenko.s...@gmail.com>
> ---
>  drivers/usb/core/hcd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 49550790a3cb..eb48f0db62ad 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -2520,6 +2520,7 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver 
> *driver,
>               hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex),
>                               GFP_KERNEL);
>               if (!hcd->bandwidth_mutex) {
> +                     kfree(hcd->address0_mutex);
>                       kfree(hcd);
>                       dev_dbg(dev, "hcd bandwidth mutex alloc failed\n");
>                       return NULL;

Acked-by: Alan Stern <st...@rowland.harvard.edu>

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to