summaryrefslogtreecommitdiff
path: root/Documentation/devicetree/bindings/usb
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2023-12-11 18:32:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-15 15:54:09 +0300
commit44995e6f07028f798efd0c3c11a1efc78330f600 (patch)
treec20cf4e961f2e5d575b4615caa14fc0fa556ff3b /Documentation/devicetree/bindings/usb
parent7d530f4cc0632056d9f8f207245aa3d91a25d168 (diff)
downloadlinux-44995e6f07028f798efd0c3c11a1efc78330f600.tar.xz
usb: core: Fix crash w/ usb_choose_configuration() if no driver
It's possible that usb_choose_configuration() can get called when a USB device has no driver. In this case the recent commit a87b8e3be926 ("usb: core: Allow subclassed USB drivers to override usb_choose_configuration()") can cause a crash since it dereferenced the driver structure without checking for NULL. Let's add a check. A USB device with no driver is an anomaly, so make usb_choose_configuration() return immediately if there is no driver. This was seen in the real world when usbguard got ahold of a r8152 device at the wrong time. It can also be simulated via this on a computer with one r8152-based USB Ethernet adapter: cd /sys/bus/usb/drivers/r8152-cfgselector to_unbind="$(ls -d *-*)" real_dir="$(readlink -f "${to_unbind}")" echo "${to_unbind}" > unbind cd "${real_dir}" echo 0 > authorized echo 1 > authorized Fixes: a87b8e3be926 ("usb: core: Allow subclassed USB drivers to override usb_choose_configuration()") Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20231211073237.v3.1.If27eb3bf7812f91ab83810f232292f032f4203e0@changeid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/devicetree/bindings/usb')
0 files changed, 0 insertions, 0 deletions