Skip to contentSkip to conversation

HID: intel-ish-hid: fix NULL-ptr-deref in ishtp_bus_remove_all_clients

PATCH In review Ryan Lin 2 participants 3 messages Jan 30 – Feb 2

Subsystems (2)
lore
Share & tools
lore

Ryan Lin

author
#0 lore raw

PATCH v2 1/1 HID: intel-ish-hid: fix NULL-ptr-deref in ishtp_bus_remove_all_clients

During a warm reset flow, the cl->device pointer may be NULL if the reset occurs while clients are still being enumerated. Accessing cl->device->reference_count without a NULL check leads to a kernel panic.

This issue was identified during multi-unit warm reboot stress clycles. Add a defensive NULL check for cl->device to ensure stability under such intensive testing conditions.

KASAN: null-ptr-deref in range [0000000000000000-0000000000000007]
Workqueue: ish_fw_update_wq fw_reset_work_fn

Call Trace:
 ishtp_bus_remove_all_clients+0xbe/0x130 [intel_ishtp]
 ishtp_reset_handler+0x85/0x1a0 [intel_ishtp]
 fw_reset_work_fn+0x8a/0xc0 [intel_ish_ipc]
Fixes 3703f53b99e4a ("HID: intel_ish-hid: ISH Transport layer")
---
 drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/intel-ish-hid/ishtp/bus.c +1 -1
index c3915f3a060e..b890fbf97a75 100644
@@ -730,7 +730,7 @@ void ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,
 	spin_lock_irqsave(&ishtp_dev->cl_list_lock, flags);
 	list_for_each_entry(cl, &ishtp_dev->cl_list, link) {
 		cl->state = ISHTP_CL_DISCONNECTED;
-		if (warm_reset && cl->device->reference_count)
+		if (warm_reset && cl->device && cl->device->reference_count)
 			continue;
 
 		/*
Signature · 1 line
2.34.1
author
#1 lore raw

Hi Jiri and Benjamin,

Looping you in for this v2. Apologies for the oversight in the To list.

Thanks,
Ryan

Quoted 48 lines

-----Original Message-----
From: Lin, Ryan <[email protected]>
Sent: Friday, January 30, 2026 1:35 PM
To: [email protected]; [email protected]; [email protected]; Zhang, Lixu <[email protected]>
Cc: Lin, Ryan <[email protected]>
Subject: [PATCH v2] HID: intel-ish-hid: fix NULL-ptr-deref in ishtp_bus_remove_all_clients

During a warm reset flow, the cl->device pointer may be NULL if the reset occurs while clients are still being enumerated. Accessing cl->device->reference_count without a NULL check leads to a kernel panic.

This issue was identified during multi-unit warm reboot stress clycles. Add a defensive NULL check for cl->device to ensure stability under such intensive testing conditions.

KASAN: null-ptr-deref in range [0000000000000000-0000000000000007]
Workqueue: ish_fw_update_wq fw_reset_work_fn

Call Trace:
 ishtp_bus_remove_all_clients+0xbe/0x130 [intel_ishtp]
 ishtp_reset_handler+0x85/0x1a0 [intel_ishtp]
 fw_reset_work_fn+0x8a/0xc0 [intel_ish_ipc]
Fixes 3703f53b99e4a ("HID: intel_ish-hid: ISH Transport layer")
---
 drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/intel-ish- renamed from drivers/hid/intel-ish-hid/ishtp/bus.c +0 -0

hid/ishtp/bus.c
index c3915f3a060e..b890fbf97a75 100644

drivers/hid/intel-ish-hid/ishtp/bus.c +1 -1
@@ -730,7 +730,7 @@ void ishtp_bus_remove_all_clients(struct ishtp_device
 *ishtp_dev,
 	spin_lock_irqsave(&ishtp_dev->cl_list_lock, flags);
 	list_for_each_entry(cl, &ishtp_dev->cl_list, link) {
 		cl->state = ISHTP_CL_DISCONNECTED;
-		if (warm_reset && cl->device->reference_count)
+		if (warm_reset && cl->device && cl->device->reference_count)
 			continue;
 

/*
--
2.34.1

maintainer
#2 lore raw
Quoted 3 lines · Ryan

Hi Jiri and Benjamin,

Looping you in for this v2. Apologies for the oversight in the To list.

Thanks for fixing that up. I've now queued the patch.

Signature · 2 lines
Jiri Kosina
SUSE Labs