]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: ims-pcu - fix type confusion in CDC union descriptor parsing
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 22 May 2026 17:25:11 +0000 (10:25 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 7 Jun 2026 04:03:34 +0000 (21:03 -0700)
The driver currently trusts the bMasterInterface0 from the CDC union
descriptor without verifying that it matches the interface being
probed. This could lead to the driver overwriting the private data of
another interface.

Validate that the control interface found in the descriptor is indeed
the one we are probing.

Fixes: 628329d52474 ("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>
drivers/input/misc/ims-pcu.c

index 694490b2462920c04e60d26c428fbdfd9dc3fa4c..ea11368834a3bfdcecd3ba2002679329d1d97cce 100644 (file)
@@ -1700,7 +1700,7 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 
        pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev,
                                         union_desc->bMasterInterface0);
-       if (!pcu->ctrl_intf)
+       if (pcu->ctrl_intf != intf)
                return -EINVAL;
 
        alt = pcu->ctrl_intf->cur_altsetting;