--- /dev/null
+From 48c9d92fd4ee3a8f5d2cb46c802a0eff8e67c79c Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:40:54 -0700
+Subject: Input: ims-pcu - add response length checks
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit 48c9d92fd4ee3a8f5d2cb46c802a0eff8e67c79c upstream.
+
+The driver processes response data from device buffers without verifying
+that the device actually sent enough data. This can lead to
+out-of-bounds reads or processing stale data.
+
+Add checks for the expected response length before accessing the
+buffers.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 87 ++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 81 insertions(+), 6 deletions(-)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -407,7 +407,16 @@ static void ims_pcu_destroy_gamepad(stru
+
+ static void ims_pcu_report_events(struct ims_pcu *pcu)
+ {
+- u32 data = get_unaligned_be32(&pcu->read_buf[3]);
++ u32 data;
++
++ /* 6-axis setting (1 byte) + button data + checksum */
++ if (pcu->read_pos < IMS_PCU_DATA_OFFSET + 1 + sizeof(data) + 1) {
++ dev_warn(pcu->dev, "Short buttons report: %d bytes\n",
++ pcu->read_pos);
++ return;
++ }
++
++ data = get_unaligned_be32(&pcu->read_buf[IMS_PCU_DATA_OFFSET + 1]);
+
+ ims_pcu_buttons_report(pcu, data & ~IMS_PCU_GAMEPAD_MASK);
+ if (pcu->gamepad)
+@@ -667,11 +676,19 @@ static int __ims_pcu_execute_bl_command(
+ return error;
+ }
+
+- if (expected_response && pcu->cmd_buf[2] != expected_response) {
+- dev_err(pcu->dev,
+- "Unexpected response from bootloader: 0x%02x, wanted 0x%02x\n",
+- pcu->cmd_buf[2], expected_response);
+- return -EINVAL;
++ if (expected_response) {
++ if (pcu->cmd_buf_len < 3) {
++ dev_err(pcu->dev, "Short response from bootloader: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
++ if (pcu->cmd_buf[2] != expected_response) {
++ dev_err(pcu->dev,
++ "Unexpected response from bootloader: 0x%02x, wanted 0x%02x\n",
++ pcu->cmd_buf[2], expected_response);
++ return -EINVAL;
++ }
+ }
+
+ return 0;
+@@ -699,6 +716,12 @@ static int ims_pcu_get_info(struct ims_p
+ return error;
+ }
+
++ if (pcu->cmd_buf_len < IMS_PCU_DATA_OFFSET + IMS_PCU_SET_INFO_SIZE + 1) {
++ dev_err(pcu->dev, "Short GET_INFO response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ memcpy(pcu->part_number,
+ &pcu->cmd_buf[IMS_PCU_INFO_PART_OFFSET],
+ sizeof(pcu->part_number));
+@@ -796,6 +819,12 @@ static int ims_pcu_verify_block(struct i
+ return error;
+ }
+
++ if (pcu->cmd_buf_len < IMS_PCU_BL_DATA_OFFSET + sizeof(*fragment) + len + 1) {
++ dev_err(pcu->dev, "Short READ_APP response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ fragment = (void *)&pcu->cmd_buf[IMS_PCU_BL_DATA_OFFSET];
+ if (get_unaligned_le32(&fragment->addr) != addr ||
+ fragment->len != len) {
+@@ -993,6 +1022,10 @@ ims_pcu_backlight_get_brightness(struct
+ error);
+ /* Assume the LED is OFF */
+ brightness = LED_OFF;
++ } else if (pcu->cmd_buf_len < IMS_PCU_DATA_OFFSET + 2 + 1) {
++ dev_err(pcu->dev, "Short GET_BRIGHTNESS response: %d bytes\n",
++ pcu->cmd_buf_len);
++ brightness = LED_OFF;
+ } else {
+ brightness =
+ get_unaligned_le16(&pcu->cmd_buf[IMS_PCU_DATA_OFFSET]);
+@@ -1272,6 +1305,12 @@ static int ims_pcu_read_ofn_config(struc
+ if (error)
+ return error;
+
++ if (pcu->cmd_buf_len < OFN_REG_RESULT_OFFSET + 2 + 1) {
++ dev_err(pcu->dev, "Short OFN_GET_CONFIG response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ result = (s16)get_unaligned_le16(pcu->cmd_buf + OFN_REG_RESULT_OFFSET);
+ if (result < 0)
+ return -EIO;
+@@ -1292,6 +1331,12 @@ static int ims_pcu_write_ofn_config(stru
+ if (error)
+ return error;
+
++ if (pcu->cmd_buf_len < OFN_REG_RESULT_OFFSET + 2 + 1) {
++ dev_err(pcu->dev, "Short OFN_SET_CONFIG response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ result = (s16)get_unaligned_le16(pcu->cmd_buf + OFN_REG_RESULT_OFFSET);
+ if (result < 0)
+ return -EIO;
+@@ -1811,6 +1856,12 @@ static int ims_pcu_get_device_info(struc
+ return error;
+ }
+
++ if (pcu->cmd_buf_len < IMS_PCU_DATA_OFFSET + 6 + 1) {
++ dev_err(pcu->dev, "Short GET_FW_VERSION response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ snprintf(pcu->fw_version, sizeof(pcu->fw_version),
+ "%02d%02d%02d%02d.%c%c",
+ pcu->cmd_buf[2], pcu->cmd_buf[3], pcu->cmd_buf[4], pcu->cmd_buf[5],
+@@ -1823,6 +1874,12 @@ static int ims_pcu_get_device_info(struc
+ return error;
+ }
+
++ if (pcu->cmd_buf_len < IMS_PCU_DATA_OFFSET + 6 + 1) {
++ dev_err(pcu->dev, "Short GET_BL_VERSION response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ snprintf(pcu->bl_version, sizeof(pcu->bl_version),
+ "%02d%02d%02d%02d.%c%c",
+ pcu->cmd_buf[2], pcu->cmd_buf[3], pcu->cmd_buf[4], pcu->cmd_buf[5],
+@@ -1835,6 +1892,12 @@ static int ims_pcu_get_device_info(struc
+ return error;
+ }
+
++ if (pcu->cmd_buf_len < IMS_PCU_DATA_OFFSET + 1 + 1) {
++ dev_err(pcu->dev, "Short RESET_REASON response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ snprintf(pcu->reset_reason, sizeof(pcu->reset_reason),
+ "%02x", pcu->cmd_buf[IMS_PCU_DATA_OFFSET]);
+
+@@ -1861,6 +1924,12 @@ static int ims_pcu_identify_type(struct
+ return error;
+ }
+
++ if (pcu->cmd_buf_len < IMS_PCU_DATA_OFFSET + 1 + 1) {
++ dev_err(pcu->dev, "Short GET_DEVICE_ID response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ *device_id = pcu->cmd_buf[IMS_PCU_DATA_OFFSET];
+ dev_dbg(pcu->dev, "Detected device ID: %d\n", *device_id);
+
+@@ -1966,6 +2035,12 @@ static int ims_pcu_init_bootloader_mode(
+ return error;
+ }
+
++ if (pcu->cmd_buf_len < IMS_PCU_DATA_OFFSET + 15 + 4 + 1) {
++ dev_err(pcu->dev, "Short QUERY_DEVICE response: %d bytes\n",
++ pcu->cmd_buf_len);
++ return -EIO;
++ }
++
+ pcu->fw_start_addr =
+ get_unaligned_le32(&pcu->cmd_buf[IMS_PCU_DATA_OFFSET + 11]);
+ pcu->fw_end_addr =
--- /dev/null
+From 8adf4289d945e8990e4336436a97da71d21d2cae Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:30:44 -0700
+Subject: Input: ims-pcu - fix DMA mapping violation in line setup
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit 8adf4289d945e8990e4336436a97da71d21d2cae upstream.
+
+In ims_pcu_line_setup(), the driver uses pcu->cmd_buf as a transfer
+buffer for usb_control_msg(). However, pcu->cmd_buf is embedded in the
+struct ims_pcu allocation, which violates DMA mapping rules regarding
+cacheline alignment.
+
+Use a heap-allocated buffer for the line coding data instead.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -1808,11 +1808,16 @@ static void ims_pcu_stop_io(struct ims_p
+ static int ims_pcu_line_setup(struct ims_pcu *pcu)
+ {
+ struct usb_host_interface *interface = pcu->ctrl_intf->cur_altsetting;
+- struct usb_cdc_line_coding *line = (void *)pcu->cmd_buf;
++ struct usb_cdc_line_coding *line __free(kfree) =
++ kmalloc(sizeof(*line), GFP_KERNEL);
+ int error;
+
+- memset(line, 0, sizeof(*line));
++ if (!line)
++ return -ENOMEM;
++
+ line->dwDTERate = cpu_to_le32(57600);
++ line->bCharFormat = USB_CDC_1_STOP_BITS;
++ line->bParityType = USB_CDC_NO_PARITY;
+ line->bDataBits = 8;
+
+ error = usb_control_msg(pcu->udev, usb_sndctrlpipe(pcu->udev, 0),
--- /dev/null
+From 403b0a6970b1084bb27907c0f8225801fdd0fe1d Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:30:21 -0700
+Subject: Input: ims-pcu - fix out-of-bounds read in ims_pcu_irq() debug logging
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit 403b0a6970b1084bb27907c0f8225801fdd0fe1d upstream.
+
+The debug logging in ims_pcu_irq() unconditionally prints data from
+pcu->urb_in_buf. However, if the interrupt fired for pcu->urb_ctrl, the
+actual data resides in pcu->urb_ctrl_buf. If urb->actual_length for the
+control URB exceeds pcu->max_in_size, this leads to an out-of-bounds
+read.
+
+Fix this by printing from the correct buffer associated with the URB.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -1547,7 +1547,7 @@ static void ims_pcu_irq(struct urb *urb)
+ }
+
+ dev_dbg(pcu->dev, "%s: received %d: %*ph\n", __func__,
+- urb->actual_length, urb->actual_length, pcu->urb_in_buf);
++ urb->actual_length, urb->actual_length, urb->transfer_buffer);
+
+ if (urb == pcu->urb_in)
+ ims_pcu_process_data(pcu, urb);
--- /dev/null
+From d4579af29e67ca8722db0a1194227f8015c8981d Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 21:42:39 -0700
+Subject: Input: ims-pcu - fix potential infinite loop in CDC union descriptor parsing
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit d4579af29e67ca8722db0a1194227f8015c8981d upstream.
+
+The driver parses CDC union descriptors in ims_pcu_get_cdc_union_desc()
+by iterating through the extra descriptor data. However, it does not
+verify that the bLength of each descriptor is at least 2. A malicious
+device could provide a descriptor with bLength = 0, leading to an
+infinite loop in the driver.
+
+Add a check to ensure bLength is at least 2 before proceeding with
+parsing.
+
+Fixes: 628329d52474 (Input: add IMS Passenger Control Unit driver)
+Cc: stable@vger.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>
+---
+ drivers/input/misc/ims-pcu.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -1675,8 +1675,9 @@ ims_pcu_get_cdc_union_desc(struct usb_in
+ while (buflen >= sizeof(*union_desc)) {
+ union_desc = (struct usb_cdc_union_desc *)buf;
+
+- if (union_desc->bLength > buflen) {
+- dev_err(&intf->dev, "Too large descriptor\n");
++ if (union_desc->bLength < 2 || union_desc->bLength > buflen) {
++ dev_err(&intf->dev, "Invalid descriptor length: %d\n",
++ union_desc->bLength);
+ return NULL;
+ }
+
--- /dev/null
+From 411b8c4b274737c3bf08e1e025801161603cfffc Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:29:04 -0700
+Subject: Input: ims-pcu - fix race condition in reset_device sysfs callback
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit 411b8c4b274737c3bf08e1e025801161603cfffc upstream.
+
+The ims_pcu_reset_device() sysfs callback calls ims_pcu_execute_command()
+without acquiring pcu->cmd_mutex. This can lead to data races and
+corruption of the shared command buffer if triggered concurrently with
+other commands.
+
+Acquire pcu->cmd_mutex before calling ims_pcu_execute_command().
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -1173,6 +1173,8 @@ static ssize_t ims_pcu_reset_device(stru
+
+ dev_info(pcu->dev, "Attempting to reset device\n");
+
++ guard(mutex)(&pcu->cmd_mutex);
++
+ error = ims_pcu_execute_command(pcu, PCU_RESET, &reset_byte, 1);
+ if (error) {
+ dev_info(pcu->dev,
--- /dev/null
+From ca459e237bc49567649c56bc72e4c602fb92fd67 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:25:11 -0700
+Subject: Input: ims-pcu - fix type confusion in CDC union descriptor parsing
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit ca459e237bc49567649c56bc72e4c602fb92fd67 upstream.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -1715,7 +1715,7 @@ static int ims_pcu_parse_cdc_data(struct
+
+ 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;
--- /dev/null
+From 462a999917755a3bf77448dfd64307963cf0a9f0 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:24:47 -0700
+Subject: Input: ims-pcu - fix use-after-free and double-free in disconnect
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit 462a999917755a3bf77448dfd64307963cf0a9f0 upstream.
+
+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: 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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -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 us
+ * 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);
--- /dev/null
+From 441c510a649c8ddce38aa0311334ed8bb546b36c Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:22:55 -0700
+Subject: Input: ims-pcu - release data interface on disconnect
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit 441c510a649c8ddce38aa0311334ed8bb546b36c upstream.
+
+During probe the driver claims the data interface, but it never releases
+it. Release it in disconnect to avoid leaving it permanently claimed.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -2085,6 +2085,7 @@ static void ims_pcu_disconnect(struct us
+ ims_pcu_destroy_application_mode(pcu);
+
+ ims_pcu_buffers_free(pcu);
++ usb_driver_release_interface(&ims_pcu_driver, pcu->data_intf);
+ kfree(pcu);
+ }
+
--- /dev/null
+From baf56975806534268e24acf9a8abb1c447ce11e9 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Fri, 22 May 2026 10:29:26 -0700
+Subject: Input: ims-pcu - validate control endpoint type
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit baf56975806534268e24acf9a8abb1c447ce11e9 upstream.
+
+The driver currently assumes that the first endpoint of the control
+interface is an interrupt IN endpoint without verifying it. A malicious
+device could provide a different endpoint type, which would then be
+passed to usb_fill_int_urb(), potentially leading to kernel warnings
+or undefined behavior.
+
+Verify that the control endpoint is an interrupt IN endpoint.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/misc/ims-pcu.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -1676,6 +1676,12 @@ static int ims_pcu_parse_cdc_data(struct
+ return -ENODEV;
+
+ pcu->ep_ctrl = &alt->endpoint[0].desc;
++ if (!usb_endpoint_is_int_in(pcu->ep_ctrl)) {
++ dev_err(pcu->dev,
++ "Control endpoint is not INTERRUPT IN\n");
++ return -EINVAL;
++ }
++
+ pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
+
+ pcu->data_intf = usb_ifnum_to_if(pcu->udev,
--- /dev/null
+From de74d8fd10291763d97b218f09adcc7513c975e4 Mon Sep 17 00:00:00 2001
+From: Doruk Tan Ozturk <doruk@0sec.ai>
+Date: Sun, 28 Jun 2026 00:30:59 +0200
+Subject: net/mlx5e: macsec: fix use-after-free of metadata_dst on RX SC delete
+
+From: Doruk Tan Ozturk <doruk@0sec.ai>
+
+commit de74d8fd10291763d97b218f09adcc7513c975e4 upstream.
+
+When an offloaded MACsec RX SC is deleted, macsec_del_rxsc_ctx() freed
+the per-SC metadata_dst with metadata_dst_free(), which kfree()s the
+object unconditionally and ignores the dst reference count. The RX
+datapath in mlx5e_macsec_offload_handle_rx_skb() looks up the SC under
+rcu_read_lock() via xa_load(), takes a reference with dst_hold() and
+attaches the dst to the skb with skb_dst_set(). A reader that already
+obtained the rx_sc pointer can race with the delete path and operate on
+freed memory.
+
+Fix the owner side by dropping the reference with dst_release() instead
+of freeing unconditionally, and convert the RX datapath to
+dst_hold_safe() so a reader racing the SC delete cannot attach a dst
+whose last reference was just dropped; only attach it when a reference
+was actually taken.
+
+mlx5e_macsec_add_rxsc() also published sc_xarray_element via xa_alloc()
+before rx_sc->md_dst was allocated and initialised, so a datapath reader
+that looked the SC up by fs_id could observe rx_sc with md_dst still
+NULL or, on weakly-ordered architectures, a non-NULL md_dst pointer
+whose contents were not yet visible. NULL-check the xa_load() result and
+md_dst on the datapath, and reorder add_rxsc() so the xa_alloc() publish
+happens only after md_dst is fully initialised; the xarray RCU publish
+then pairs with the rcu_read_lock()/xa_load() in the datapath.
+
+Note: macsec_del_rxsc_ctx() also kfree()s rx_sc->sc_xarray_element
+without an RCU grace period while the same datapath reads it under
+rcu_read_lock(); that is a separate pre-existing issue left to a
+follow-up patch.
+
+Found by 0sec automated security-research tooling (https://0sec.ai).
+
+Fixes: b7c9400cbc48 ("net/mlx5e: Implement MACsec Rx data path using MACsec skb_metadata_dst")
+Cc: stable@vger.kernel.org
+Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Link: https://patch.msgid.link/20260627223059.29917-1-doruk@0sec.ai
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 47 ++++++++------
+ 1 file changed, 28 insertions(+), 19 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
+@@ -713,34 +713,43 @@ static int mlx5e_macsec_add_rxsc(struct
+ }
+
+ sc_xarray_element->rx_sc = rx_sc;
+- err = xa_alloc(&macsec->sc_xarray, &sc_xarray_element->fs_id, sc_xarray_element,
+- XA_LIMIT(1, MLX5_MACEC_RX_FS_ID_MAX), GFP_KERNEL);
+- if (err) {
+- if (err == -EBUSY)
+- netdev_err(ctx->netdev,
+- "MACsec offload: unable to create entry for RX SC (%d Rx SCs already allocated)\n",
+- MLX5_MACEC_RX_FS_ID_MAX);
+- goto destroy_sc_xarray_elemenet;
+- }
+
+ rx_sc->md_dst = metadata_dst_alloc(0, METADATA_MACSEC, GFP_KERNEL);
+ if (!rx_sc->md_dst) {
+ err = -ENOMEM;
+- goto erase_xa_alloc;
++ goto destroy_sc_xarray_elemenet;
+ }
+
+ rx_sc->sci = ctx_rx_sc->sci;
+ rx_sc->active = ctx_rx_sc->active;
+- list_add_rcu(&rx_sc->rx_sc_list_element, rx_sc_list);
+-
+ rx_sc->sc_xarray_element = sc_xarray_element;
+ rx_sc->md_dst->u.macsec_info.sci = rx_sc->sci;
++
++ /*
++ * Publish the fully-initialised SC last: xa_alloc() makes
++ * sc_xarray_element->rx_sc (and rx_sc->md_dst) reachable from the RX
++ * datapath via xa_load(). Doing it only after md_dst is allocated and
++ * initialised pairs with the rcu_read_lock()/xa_load() in
++ * mlx5e_macsec_offload_handle_rx_skb(), so a reader can never observe
++ * a non-NULL md_dst with uninitialised contents.
++ */
++ err = xa_alloc(&macsec->sc_xarray, &sc_xarray_element->fs_id, sc_xarray_element,
++ XA_LIMIT(1, MLX5_MACEC_RX_FS_ID_MAX), GFP_KERNEL);
++ if (err) {
++ if (err == -EBUSY)
++ netdev_err(ctx->netdev,
++ "MACsec offload: unable to create entry for RX SC (%d Rx SCs already allocated)\n",
++ MLX5_MACEC_RX_FS_ID_MAX);
++ goto destroy_md_dst;
++ }
++
++ list_add_rcu(&rx_sc->rx_sc_list_element, rx_sc_list);
+ mutex_unlock(&macsec->lock);
+
+ return 0;
+
+-erase_xa_alloc:
+- xa_erase(&macsec->sc_xarray, sc_xarray_element->fs_id);
++destroy_md_dst:
++ dst_release(&rx_sc->md_dst->dst);
+ destroy_sc_xarray_elemenet:
+ kfree(sc_xarray_element);
+ destroy_rx_sc:
+@@ -828,7 +837,7 @@ static void macsec_del_rxsc_ctx(struct m
+ */
+ list_del_rcu(&rx_sc->rx_sc_list_element);
+ xa_erase(&macsec->sc_xarray, rx_sc->sc_xarray_element->fs_id);
+- metadata_dst_free(rx_sc->md_dst);
++ dst_release(&rx_sc->md_dst->dst);
+ kfree(rx_sc->sc_xarray_element);
+ kfree_rcu_mightsleep(rx_sc);
+ }
+@@ -1698,10 +1707,10 @@ void mlx5e_macsec_offload_handle_rx_skb(
+
+ rcu_read_lock();
+ sc_xarray_element = xa_load(&macsec->sc_xarray, fs_id);
+- rx_sc = sc_xarray_element->rx_sc;
+- if (rx_sc) {
+- dst_hold(&rx_sc->md_dst->dst);
+- skb_dst_set(skb, &rx_sc->md_dst->dst);
++ rx_sc = sc_xarray_element ? sc_xarray_element->rx_sc : NULL;
++ if (rx_sc && rx_sc->md_dst) {
++ if (dst_hold_safe(&rx_sc->md_dst->dst))
++ skb_dst_set(skb, &rx_sc->md_dst->dst);
+ }
+
+ rcu_read_unlock();
scsi-target-core-fix-iscsi-isid-use-after-free-in-register-and-move.patch
scsi-elx-efct-fix-refcount-leak-in-efct_hw_io_abort.patch
scsi-elx-efct-fix-i-o-leak-on-unsupported-additional-cdb.patch
+input-ims-pcu-fix-use-after-free-and-double-free-in-disconnect.patch
+input-ims-pcu-release-data-interface-on-disconnect.patch
+input-ims-pcu-validate-control-endpoint-type.patch
+input-ims-pcu-add-response-length-checks.patch
+input-ims-pcu-fix-dma-mapping-violation-in-line-setup.patch
+input-ims-pcu-fix-out-of-bounds-read-in-ims_pcu_irq-debug-logging.patch
+input-ims-pcu-fix-potential-infinite-loop-in-cdc-union-descriptor-parsing.patch
+input-ims-pcu-fix-race-condition-in-reset_device-sysfs-callback.patch
+input-ims-pcu-fix-type-confusion-in-cdc-union-descriptor-parsing.patch
+net-mlx5e-macsec-fix-use-after-free-of-metadata_dst-on-rx-sc-delete.patch