From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Zhang Lixu <lixu.zhang@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Benjamin Tissoires <bentiss@kernel.org>,
Sasha Levin <sashal@kernel.org>,
jikos@kernel.org, andriy.shevchenko@intel.com
Subject: [PATCH AUTOSEL 6.18-6.1] HID: intel-ish-hid: Update ishtp bus match to support device ID table
Date: Mon, 12 Jan 2026 09:58:08 -0500 [thread overview]
Message-ID: <20260112145840.724774-7-sashal@kernel.org> (raw)
In-Reply-To: <20260112145840.724774-1-sashal@kernel.org>
From: Zhang Lixu <lixu.zhang@intel.com>
[ Upstream commit daeed86b686855adda79f13729e0c9b0530990be ]
The ishtp_cl_bus_match() function previously only checked the first entry
in the driver's device ID table. Update it to iterate over the entire
table, allowing proper matching for drivers with multiple supported
protocol GUIDs.
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Analysis of Commit: HID: intel-ish-hid: Update ishtp bus match to
support device ID table
### 1. COMMIT MESSAGE ANALYSIS
The commit message clearly describes:
- **The problem**: The `ishtp_cl_bus_match()` function only checked the
first entry (`id[0]`) in the driver's device ID table
- **The fix**: Iterate over the entire ID table
- **The purpose**: Allow proper matching for drivers with multiple
supported protocol GUIDs
No "Fixes:" tag or "Reported-by:" tag is present (expected for commits
under manual review).
### 2. CODE CHANGE ANALYSIS
**Before (buggy code):**
```c
return(device->fw_client ? guid_equal(&driver->id[0].guid,
&device->fw_client->props.protocol_name) : 0);
```
Only checks the **first entry** (`driver->id[0]`) in the device ID
table.
**After (fixed code):**
```c
if (client) {
for (id = driver->id; !guid_is_null(&id->guid); id++) {
if (guid_equal(&id->guid, &client->props.protocol_name))
return 1;
}
}
return 0;
```
Properly iterates through **all entries** until finding a match or
hitting the null GUID terminator.
**Root cause**: Logic error - incomplete iteration through device ID
table. This is objectively incorrect behavior for a bus match function.
Standard Linux bus matching iterates through all device IDs in a
driver's table.
**Technical mechanism**: When a device with a protocol GUID that matches
the 2nd, 3rd, or later entry in a driver's ID table is enumerated, the
old code would fail to match, leaving the device without a driver.
### 3. CLASSIFICATION
- **Bug fix**: Yes - this fixes fundamentally broken device matching
logic
- **New feature**: No - it corrects existing functionality to work as
designed
- **Exception category**: Not needed - it's a straightforward bug fix
### 4. SCOPE AND RISK ASSESSMENT
- **Lines changed**: ~10 lines of actual code
- **Files touched**: 1 (drivers/hid/intel-ish-hid/ishtp/bus.c)
- **Complexity**: Low - simple loop structure following standard
patterns
- **Subsystem**: Intel ISH (Integrated Sensor Hub) HID driver
- **Risk**: Very low - if wrong, devices wouldn't match (no
crashes/corruption)
The change follows the standard Linux bus matching pattern used across
the kernel (iterate until null terminator).
### 5. USER IMPACT
- **Affected users**: Intel ISH users with drivers supporting multiple
protocol GUIDs
- **Severity**: Medium - affected devices simply wouldn't work (wouldn't
bind to their driver)
- **Real bug**: Yes - the code was objectively wrong
### 6. STABILITY INDICATORS
- **Acked-by**: Srinivas Pandruvada (Intel ISH maintainer)
- **Signed-off-by**: Benjamin Tissoires (HID subsystem maintainer)
- Pattern follows well-established Linux driver matching conventions
### 7. DEPENDENCY CHECK
- Self-contained, no dependencies on other commits
- The `ishtp_cl_bus_match()` function exists in stable trees
- No new APIs or infrastructure required
### RISK VS BENEFIT TRADE-OFF
**Benefits:**
- Fixes obviously incorrect code in bus matching
- Enables proper device/driver matching for drivers with multiple IDs
- Small, surgical, low-risk change
- Follows standard kernel patterns
**Risks:**
- Minimal - only affects ISH device matching
- Failure mode is "device doesn't match" not crash/corruption
**Concerns:**
- No explicit bug report showing users hitting this
- Could be seen as enabling new functionality if no drivers currently
use multiple IDs
### CONCLUSION
This commit fixes objectively incorrect behavior in the ISHTP bus
matching function. The old code only checking `id[0]` is clearly wrong
for a device ID table that's designed to hold multiple entries. The fix
is small, surgical, follows standard kernel patterns, and has low risk.
Even without an explicit user report, fixing fundamentally broken
matching logic is appropriate for stable trees. The change is acked by
the Intel maintainer and the HID subsystem maintainer.
The fix is self-contained, doesn't introduce new APIs, and corrects a
logic error that would prevent devices from working if their GUID wasn't
first in the table.
**YES**
drivers/hid/intel-ish-hid/ishtp/bus.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index 93a0432e70581..8e9f5a28e62ec 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -240,9 +240,17 @@ static int ishtp_cl_bus_match(struct device *dev, const struct device_driver *dr
{
struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv);
+ struct ishtp_fw_client *client = device->fw_client;
+ const struct ishtp_device_id *id;
- return(device->fw_client ? guid_equal(&driver->id[0].guid,
- &device->fw_client->props.protocol_name) : 0);
+ if (client) {
+ for (id = driver->id; !guid_is_null(&id->guid); id++) {
+ if (guid_equal(&id->guid, &client->props.protocol_name))
+ return 1;
+ }
+ }
+
+ return 0;
}
/**
--
2.51.0
next prev parent reply other threads:[~2026-01-12 14:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 14:58 [PATCH AUTOSEL 6.18] HID: Elecom: Add support for ELECOM M-XT3DRBK (018C) Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] x86/sev: Disable GCOV on noinstr object Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] wifi: mac80211: collect station statistics earlier when disconnect Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] btrfs: do not free data reservation in fallback from inline due to -ENOSPC Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] btrfs: fix deadlock in wait_current_trans() due to ignored transaction type Sasha Levin
2026-01-19 11:46 ` Motiejus Jakštys
2026-01-20 11:03 ` Greg KH
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: quirks: Add another Chicony HP 5MP Cameras to hid_ignore_list Sasha Levin
2026-01-12 14:58 ` Sasha Levin [this message]
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: multitouch: add MT_QUIRK_STICKY_FINGERS to MT_CLS_VTL Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.1] HID: i2c-hid: fix potential buffer overflow in i2c_hid_get_report() Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] riscv: trace: fix snapshot deadlock with sbi ecall Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] drm/amd/pm: Disable MMIO access during SMU Mode 1 reset Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] riscv: Sanitize syscall table indexing under speculation Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.15] netfilter: replace -EEXIST with -EBUSY Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] PCI: qcom: Remove ASPM L0s support for MSM8996 SoC Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] ALSA: hda/realtek: add HP Laptop 15s-eq1xxx mute LED quirk Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] ring-buffer: Avoid softlockup in ring_buffer_resize() during memory free Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.15] HID: playstation: Center initial joystick axes to prevent spurious events Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: intel-ish-hid: Reset enum_devices_done before enumeration Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] drm/amd/display: Reduce number of arguments of dcn30's CalculatePrefetchSchedule() Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: Apply quirk HID_QUIRK_ALWAYS_POLL to Edifier QR30 (2d99:a101) Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.1] btrfs: fix reservation leak in some error paths when inserting inline extent Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] ALSA: hda/realtek: Add quirk for Acer Nitro AN517-55 Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] HID: logitech: add HID++ support for Logitech MX Anywhere 3S Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] HID: Intel-thc-hid: Intel-thc: Add safety check for reading DMA buffer Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: usbhid: paper over wrong bNumDescriptor field Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260112145840.724774-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=lixu.zhang@intel.com \
--cc=patches@lists.linux.dev \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox