lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 16 Mar 2015 17:48:49 +0800
From:	Yunzhi Li <lyz@...k-chips.com>
To:	Vincent Palatin <vpalatin@...omium.org>, linux-usb@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>
CC:	Doug Anderson <dianders@...omium.org>,
	Julius Werner <jwerner@...gle.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	John Youn <johnyoun@...opsys.com>
Subject: Re: [PATCH RESEND] usb: dwc2: avoid leaking DMA channels on disconnection

Hi
> When the HCD is disconnected, the DMA transfers still in-flight were cleaned-up
> but the count of available DMA channels (e.g. available_host_channels) was not
> reset.
> The pool of DMA channels can be depleted when doing unclean
> disconnection of USB peripherals, and reaches the point where no
> transfer was possible until the next reboot/reload of the driver.
>
> Tested by putting a programmable USB mux on the port and randomly
> plugging/unpluging a USB HUB with USB mass-storage key, USB-audio and
> USB-ethernet dongle connected to its downstream ports, and also doing the
> disconnection early while the devices are still enumerating to get more URBs
> in-flight.
> After the patch, the devices are still enumerating after thousands of cycles,
> while the port was totally dead before.
>
> Signed-off-by: Vincent Palatin <vpalatin@...omium.org>
> ---
> I'm re-sending it, it seems the previous email did not show up.
>
>   drivers/usb/dwc2/hcd.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> index c78c874..559b55e 100644
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
> @@ -257,6 +257,14 @@ static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg)
>   		 */
>   		channel->qh = NULL;
>   	}
> +	/* All channels have been freed, mark them available */
> +	if (hsotg->core_params->uframe_sched > 0) {
> +		hsotg->available_host_channels =
> +			hsotg->core_params->host_channels;
> +	} else {
> +		hsotg->non_periodic_channels = 0;
> +		hsotg->periodic_channels = 0;
> +	}
>   }
>   
>   /**

I have reviewed this patch. Obviously,it makes sense.

Reviewed-by: Yunzhi Li <lyz@...k-chips.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ