[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1312041014460.1329-100000@iolanthe.rowland.org>
Date: Wed, 4 Dec 2013 10:21:07 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Julius Werner <jwerner@...omium.org>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
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] usb: core: Abort deauthorization if unsetting configuration
fails
On Tue, 3 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.
>
> This patch ensures that usb_deauthorize_device() aborts when
> usb_set_configuration() fails, and the underlying status code (such as
> ENODEV) is returned to userspace.
I don't like this approach at all. It should always be possible to
deauthorize a device, no matter what.
Instead, how about changing usb_set_configuration() so that it will
never fail when the new config is -1? Except perhaps for -ENODEV
errors (the device has been disconnected), which
usb_deauthorize_device() could check for.
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