Re: [PATCH 2/3] hwmon: lenovo-ec-sensors: Fix NULL pointer dereference when DMI match fails
From: Guenter Roeck
Date: Wed May 13 2026 - 21:29:22 EST
On 5/13/26 18:14, Kean wrote:
dmi_first_match() returns NULL if the running system does not match any
entry in thinkstation_dmi_table. Without a NULL check, the subsequent
dmi_id->driver_data access dereferences a NULL pointer, causing a kernel
oops or panic.
Add a NULL check and return -ENODEV to gracefully fail the probe when
the driver is loaded on an unsupported platform.
How would that happen in practice ? The driver init code has
if (!dmi_check_system(thinkstation_dmi_table))
return -ENODEV;
Please provide a reproducer.
Thanks,
Guenter