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]
Message-ID: <Pine.LNX.4.44L0.1312111155450.1531-100000@iolanthe.rowland.org>
Date:	Wed, 11 Dec 2013 12:02:15 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Julius Werner <jwerner@...omium.org>
cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	USB list <linux-usb@...r.kernel.org>,
	Kernel development list <linux-kernel@...r.kernel.org>,
	Thomas Pugliese <thomas.pugliese@...il.com>,
	Sarah Sharp <sarah.a.sharp@...ux.intel.com>,
	Vincent Palatin <vpalatin@...omium.org>,
	Doug Anderson <dianders@...omium.org>,
	Vivek Gautam <gautam.vivek@...sung.com>
Subject: Re: [PATCH v2] usb: core: Make sure usb_set_configuration(-1) cannot
 fail

On Thu, 5 Dec 2013, Julius Werner wrote:

> usb_deauthorize_device() tries to unset the configuration of a USB
> device and then unconditionally blows away the configuration descriptors
> with usb_destroy_configuration(). This is bad if the
> usb_set_configuration() call failed before the configuration could be
> correctly unset, since pointers like udev->actconfig can keep pointing
> to the now invalid memory. We have encountered hard to reproduce crashes
> from devices disconnected during suspend due to this, where khubd's
> disconnect handling races with userspace tools that change authorization
> on resume.
> 
> It seems desirable that a USB device can always be marked as
> unconfigured (reclaiming its bandwidth) in the kernel, regardless of
> communication problems. This patch changes usb_set_configuration() to
> ignore all failures in the case where no new configuration is being set.
> 
> Signed-off-by: Julius Werner <jwerner@...omium.org>

Sorry for not getting back to this sooner.  Ironically, it looks like 
this change isn't needed any more, thanks to Thomas Pugliese's patch:

	http://marc.info/?l=linux-usb&m=138661805209999&w=2

> --- a/drivers/usb/core/message.c
> +++ b/drivers/usb/core/message.c

> @@ -1774,7 +1775,7 @@ free_interfaces:
>  
>  	/* Wake up the device so we can send it the Set-Config request */
>  	ret = usb_autoresume_device(dev);
> -	if (ret)
> +	if (ret && cp)
>  		goto free_interfaces;

That isn't quite right.  If the autoresume fails then we have to skip 
the autosuspend call later on.

Alan Stern

--
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