From: Alan Stern Date: Tue, 24 Sep 2013 19:43:39 +0000 (-0400) Subject: USB: fix substandard locking for the sysfs files X-Git-Tag: omap-for-v3.13/fixes-for-merge-window-take2~66^2~165 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=232275a089dfd2e77377a85f11d0a4e3ca60e612;p=pandora-kernel.git USB: fix substandard locking for the sysfs files This patch straightens out some locking issues in the USB sysfs interface: Deauthorization will destroy existing configurations. Attributes that read from udev->actconfig need to lock the device to prevent races. Likewise for the rawdescriptor values. Attributes that access an interface's current alternate setting should use ACCESS_ONCE() to obtain the cur_altsetting pointer, to protect against concurrent altsetting changes. The supports_autosuspend() attribute routine accesses values from an interface's driver, so it should lock the interface (rather than the usb_device) to protect against concurrent unbinds. Once this is done, the routine can be simplified considerably. Scalar values that are stored directly in the usb_device structure are always available. They do not require any locking. The same is true of the cached interface string descriptor, because it is not deallocated until the usb_host_interface structure is destroyed. Signed-off-by: Alan Stern CC: Hans de Goede Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed