[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260210232946.302936-3-W_Armin@gmx.de>
Date: Wed, 11 Feb 2026 00:29:43 +0100
From: Armin Wolf <W_Armin@....de>
To: hansg@...nel.org,
ilpo.jarvinen@...ux.intel.com
Cc: wse@...edocomputers.com,
platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/5] 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@....de>
---
drivers/platform/x86/uniwill/uniwill-acpi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index 856d5e38e045..938e39647be5 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -1355,6 +1355,9 @@ static int uniwill_notifier_call(struct notifier_block *nb, unsigned long action
switch (action) {
case UNIWILL_OSD_BATTERY_ALERT:
+ if (!uniwill_device_supports(data, UNIWILL_FEATURE_BATTERY))
+ return NOTIFY_DONE;
+
mutex_lock(&data->battery_lock);
list_for_each_entry(entry, &data->batteries, head) {
power_supply_changed(entry->battery);
--
2.39.5
Powered by blists - more mailing lists