mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
Input: ims-pcu - fix use-after-free and double-free in disconnect
commit462a999917upstream. ims_pcu_disconnect() only intended to perform cleanup when the primary (control) interface is unbound. However, it currently relies on the interface class to distinguish between control and data interfaces. A malicious device could present a data interface with the same class as the control interface, leading to premature cleanup and potential use-after-free or double-free. Switch to verifying that the interface being disconnected is indeed the control interface. Fixes:628329d524("Input: add IMS Passenger Control Unit driver") Cc: stable@vger.kernel.org Reported-by: Sashiko bot <sashiko-bot@kernel.org> Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8c689a8f22
commit
6a6c373e6a
@@ -2065,7 +2065,6 @@ err_free_mem:
|
||||
static void ims_pcu_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
struct ims_pcu *pcu = usb_get_intfdata(intf);
|
||||
struct usb_host_interface *alt = intf->cur_altsetting;
|
||||
|
||||
usb_set_intfdata(intf, NULL);
|
||||
|
||||
@@ -2073,7 +2072,7 @@ static void ims_pcu_disconnect(struct usb_interface *intf)
|
||||
* See if we are dealing with control or data interface. The cleanup
|
||||
* happens when we unbind primary (control) interface.
|
||||
*/
|
||||
if (alt->desc.bInterfaceClass != USB_CLASS_COMM)
|
||||
if (intf != pcu->ctrl_intf)
|
||||
return;
|
||||
|
||||
sysfs_remove_group(&intf->dev.kobj, &ims_pcu_attr_group);
|
||||
|
||||
Reference in New Issue
Block a user