Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: uniwill-laptop: Fix crash on unexpected battery event

On devices that have not UNIWILL_FEATURE_BATTERY set, the underlying
hardware might still send the UNIWILL_OSD_BATTERY_ALERT event. In such
a situation, the driver will access uninitialized data structures when
handling said event.

Prevent this by only handling the UNIWILL_OSD_BATTERY_ALERT event when
UNIWILL_FEATURE_BATTERY is set.

Fixes: d050479693bb ("platform/x86: Add Uniwill laptop driver")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://patch.msgid.link/20260218005101.73680-3-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Armin Wolf and committed by
Ilpo Järvinen
67e7eb4c 2d53dfac

+3
+3
drivers/platform/x86/uniwill/uniwill-acpi.c
··· 1359 1359 1360 1360 switch (action) { 1361 1361 case UNIWILL_OSD_BATTERY_ALERT: 1362 + if (!uniwill_device_supports(data, UNIWILL_FEATURE_BATTERY)) 1363 + return NOTIFY_DONE; 1364 + 1362 1365 mutex_lock(&data->battery_lock); 1363 1366 list_for_each_entry(entry, &data->batteries, head) { 1364 1367 power_supply_changed(entry->battery);