platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
@ 2025-10-13  5:26 Kurt Borja
  2025-10-13 15:10 ` Ilpo Järvinen
  0 siblings, 1 reply; 6+ messages in thread
From: Kurt Borja @ 2025-10-13  5:26 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen, Armin Wolf
  Cc: platform-driver-x86, Dell.Client.Kernel, linux-kernel, stable,
	Gal Hammer, Kurt Borja

Initialize `awcc` with empty quirks to avoid a null pointer dereference
in sleep handlers for devices without the AWCC interface.

This also allows some code simplification in alienware_wmax_wmi_init().

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>
---
Changes in v2:
- Little logic mistake in the `force_gmode` path... (oops)
- Link to v1: https://lore.kernel.org/r/20251013-sleep-fix-v1-1-92bc11b6ecae@gmail.com
---
 drivers/platform/x86/dell/alienware-wmi-wmax.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platform/x86/dell/alienware-wmi-wmax.c
index 31f9643a6a3b5c2eb74b089dc071964bd6df8b43..cefeef84d85d111e9cc15ebed35fb83f03c41c7c 100644
--- a/drivers/platform/x86/dell/alienware-wmi-wmax.c
+++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c
@@ -393,7 +393,7 @@ static const enum platform_profile_option awcc_mode_to_platform_profile[AWCC_PRO
 	[AWCC_PROFILE_LEGACY_PERFORMANCE]		= PLATFORM_PROFILE_PERFORMANCE,
 };
 
-static struct awcc_quirks *awcc;
+static struct awcc_quirks *awcc = &empty_quirks;
 
 /*
  *	The HDMI mux sysfs node indicates the status of the HDMI input mux.
@@ -1680,22 +1680,14 @@ int __init alienware_wmax_wmi_init(void)
 	if (id)
 		awcc = id->driver_data;
 
-	if (force_hwmon) {
-		if (!awcc)
-			awcc = &empty_quirks;
-
+	if (force_hwmon)
 		awcc->hwmon = true;
-	}
-
-	if (force_platform_profile) {
-		if (!awcc)
-			awcc = &empty_quirks;
 
+	if (force_platform_profile)
 		awcc->pprof = true;
-	}
 
 	if (force_gmode) {
-		if (awcc)
+		if (awcc->pprof)
 			awcc->gmode = true;
 		else
 			pr_warn("force_gmode requires platform profile support\n");

---
base-commit: 3ed17349f18774c24505b0c21dfbd3cc4f126518
change-id: 20251012-sleep-fix-5d0596dd92a3
-- 
 ~ Kurt


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
  2025-10-13  5:26 [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers Kurt Borja
@ 2025-10-13 15:10 ` Ilpo Järvinen
  2025-10-13 19:27   ` [v2] " Markus Elfring
  2025-10-14  9:48   ` [PATCH v2] " Kurt Borja
  0 siblings, 2 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2025-10-13 15:10 UTC (permalink / raw)
  To: Hans de Goede, Armin Wolf, Kurt Borja
  Cc: platform-driver-x86, Dell.Client.Kernel, linux-kernel, stable,
	Gal Hammer

On Mon, 13 Oct 2025 00:26:26 -0500, Kurt Borja wrote:

> Initialize `awcc` with empty quirks to avoid a null pointer dereference
> in sleep handlers for devices without the AWCC interface.
> 
> This also allows some code simplification in alienware_wmax_wmi_init().
> 
> 


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
      commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98

--
 i.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
  2025-10-13 15:10 ` Ilpo Järvinen
@ 2025-10-13 19:27   ` Markus Elfring
  2025-10-14  8:18     ` Ilpo Järvinen
  2025-10-14  9:48   ` [PATCH v2] " Kurt Borja
  1 sibling, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2025-10-13 19:27 UTC (permalink / raw)
  To: Ilpo Järvinen, Kurt Borja, platform-driver-x86, Armin Wolf,
	Hans de Goede
  Cc: Dell.Client.Kernel, stable, LKML, Gal Hammer

…
> The list of commits applied:
> [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers

                                                           dereference?


>       commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98

How do you think about to avoid a typo in the summary phrase?

Regards,
Markus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
  2025-10-13 19:27   ` [v2] " Markus Elfring
@ 2025-10-14  8:18     ` Ilpo Järvinen
  0 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2025-10-14  8:18 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Kurt Borja, platform-driver-x86, Armin Wolf, Hans de Goede,
	Dell.Client.Kernel, stable, LKML, Gal Hammer

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

On Mon, 13 Oct 2025, Markus Elfring wrote:

> …
> > The list of commits applied:
> > [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
> 
>                                                            dereference?
> 
> 
> >       commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98
> 
> How do you think about to avoid a typo in the summary phrase?

Thanks for noticing it. I've corrected it now.

-- 
 i.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
  2025-10-13 15:10 ` Ilpo Järvinen
  2025-10-13 19:27   ` [v2] " Markus Elfring
@ 2025-10-14  9:48   ` Kurt Borja
  2025-10-14  9:50     ` Ilpo Järvinen
  1 sibling, 1 reply; 6+ messages in thread
From: Kurt Borja @ 2025-10-14  9:48 UTC (permalink / raw)
  To: Ilpo Järvinen, Hans de Goede, Armin Wolf, Kurt Borja
  Cc: platform-driver-x86, Dell.Client.Kernel, linux-kernel, stable,
	Gal Hammer

On Mon Oct 13, 2025 at 10:10 AM -05, Ilpo Järvinen wrote:
> On Mon, 13 Oct 2025 00:26:26 -0500, Kurt Borja wrote:
>
>> Initialize `awcc` with empty quirks to avoid a null pointer dereference
>> in sleep handlers for devices without the AWCC interface.
>> 
>> This also allows some code simplification in alienware_wmax_wmi_init().
>> 
>> 
>
>
> Thank you for your contribution, it has been applied to my local
> review-ilpo-fixes branch. Note it will show up in the public
> platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
> local branch there, which might take a while.
>
> The list of commits applied:
> [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
>       commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98
>
> --
>  i.

Hi Ilpo,

Gal has just noticed this approach prevents the old driver interface
from loading, which is a huge regression.

Do you prefer to drop this commit or should I submit a revert?

Thank you for your patience!


-- 
 ~ Kurt


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
  2025-10-14  9:48   ` [PATCH v2] " Kurt Borja
@ 2025-10-14  9:50     ` Ilpo Järvinen
  0 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2025-10-14  9:50 UTC (permalink / raw)
  To: Kurt Borja
  Cc: Hans de Goede, Armin Wolf, platform-driver-x86,
	Dell.Client.Kernel, LKML, stable, Gal Hammer

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

On Tue, 14 Oct 2025, Kurt Borja wrote:

> On Mon Oct 13, 2025 at 10:10 AM -05, Ilpo Järvinen wrote:
> > On Mon, 13 Oct 2025 00:26:26 -0500, Kurt Borja wrote:
> >
> >> Initialize `awcc` with empty quirks to avoid a null pointer dereference
> >> in sleep handlers for devices without the AWCC interface.
> >> 
> >> This also allows some code simplification in alienware_wmax_wmi_init().
> >> 
> >> 
> >
> >
> > Thank you for your contribution, it has been applied to my local
> > review-ilpo-fixes branch. Note it will show up in the public
> > platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
> > local branch there, which might take a while.
> >
> > The list of commits applied:
> > [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers
> >       commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98
> >
> > --
> >  i.
> 
> Hi Ilpo,
> 
> Gal has just noticed this approach prevents the old driver interface
> from loading, which is a huge regression.
> 
> Do you prefer to drop this commit or should I submit a revert?
> 
> Thank you for your patience!

Okay, thanks for the information. I'll drop it, it's very easy to drop as 
it's the HEAD commit.

-- 
 i.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-10-14  9:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-13  5:26 [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers Kurt Borja
2025-10-13 15:10 ` Ilpo Järvinen
2025-10-13 19:27   ` [v2] " Markus Elfring
2025-10-14  8:18     ` Ilpo Järvinen
2025-10-14  9:48   ` [PATCH v2] " Kurt Borja
2025-10-14  9:50     ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).