]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
staging: gpib: Fix Oops after disconnect in ni_usb
authorDave Penkler <dpenkler@gmail.com>
Sat, 22 Feb 2025 16:58:17 +0000 (17:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Mar 2025 13:54:20 +0000 (06:54 -0700)
commita239c6e91b665f1837cf57b97fe638ef1baf2e78
tree35d40cfd612365245fd4722a14b29303ac1b5d34
parent20a351c36afc7d72956b57bdefbc79858f18923d
staging: gpib: Fix Oops after disconnect in ni_usb

If the usb dongle is disconnected subsequent calls to the
driver cause a NULL dereference Oops as the bus_interface
is set to NULL on disconnect.

This problem was introduced by setting usb_dev from the bus_interface
for dev_xxx messages.

Previously bus_interface was checked for NULL only in the the functions
directly calling usb_fill_bulk_urb or usb_control_msg.

Check for valid bus_interface on all interface entry points
and return -ENODEV if it is NULL.

Fixes: 4934b98bb243 ("staging: gpib: Update messaging and usb_device refs in ni_usb")
Cc: stable <stable@kernel.org>
Signed-off-by: Dave Penkler <dpenkler@gmail.com>
Link: https://lore.kernel.org/r/20250222165817.12856-1-dpenkler@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gpib/ni_usb/ni_usb_gpib.c