]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: alienware-wmi-wmax: Fix NULL pointer dereference in sleep handlers
authorKurt Borja <kuurtb@gmail.com>
Tue, 14 Oct 2025 10:07:27 +0000 (05:07 -0500)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 15 Oct 2025 08:11:23 +0000 (11:11 +0300)
Devices without the AWCC interface don't initialize `awcc`. Add a check
before dereferencing it in sleep handlers.

Cc: stable@vger.kernel.org
Reported-by: Gal Hammer <galhammer@gmail.com>
Tested-by: Gal Hammer <galhammer@gmail.com>
Fixes: 07ac275981b1 ("platform/x86: alienware-wmi-wmax: Add support for manual fan control")
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Link: https://patch.msgid.link/20251014-sleep-fix-v3-1-b5cb58da4638@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/dell/alienware-wmi-wmax.c

index 31f9643a6a3b5c2eb74b089dc071964bd6df8b43..b106e8e407b3a3b769499d12f1c048f18c491430 100644 (file)
@@ -1639,7 +1639,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context)
 
 static int wmax_wmi_suspend(struct device *dev)
 {
-       if (awcc->hwmon)
+       if (awcc && awcc->hwmon)
                awcc_hwmon_suspend(dev);
 
        return 0;
@@ -1647,7 +1647,7 @@ static int wmax_wmi_suspend(struct device *dev)
 
 static int wmax_wmi_resume(struct device *dev)
 {
-       if (awcc->hwmon)
+       if (awcc && awcc->hwmon)
                awcc_hwmon_resume(dev);
 
        return 0;