diff mbox series

[v2,1/5] hwmon: (hp-wmi-sensors) Check if WMI event data exists

Message ID 20240901031055.3030-2-W_Armin@gmx.de (mailing list archive)
State Accepted
Headers show
Series platform/x86: wmi: Pass event data directly to legacy notify handlers | expand

Commit Message

Armin Wolf Sept. 1, 2024, 3:10 a.m. UTC
The BIOS can choose to return no event data in response to a
WMI event, so the ACPI object passed to the WMI notify handler
can be NULL.

Check for such a situation and ignore the event in such a case.

Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/hwmon/hp-wmi-sensors.c | 2 ++
 1 file changed, 2 insertions(+)

--
2.39.2

Comments

Ilpo Järvinen Sept. 2, 2024, 2:09 p.m. UTC | #1
On Sun, 1 Sep 2024, Armin Wolf wrote:

> The BIOS can choose to return no event data in response to a
> WMI event, so the ACPI object passed to the WMI notify handler
> can be NULL.
> 
> Check for such a situation and ignore the event in such a case.
> 
> Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Guenter Roeck Sept. 2, 2024, 2:28 p.m. UTC | #2
On Sun, Sep 01, 2024 at 05:10:51AM +0200, Armin Wolf wrote:
> The BIOS can choose to return no event data in response to a
> WMI event, so the ACPI object passed to the WMI notify handler
> can be NULL.
> 
> Check for such a situation and ignore the event in such a case.
> 
> Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Applied.

Thanks,
Guenter
Hans de Goede Sept. 4, 2024, 5:55 p.m. UTC | #3
Hi All,

On 9/2/24 4:28 PM, Guenter Roeck wrote:
> On Sun, Sep 01, 2024 at 05:10:51AM +0200, Armin Wolf wrote:
>> The BIOS can choose to return no event data in response to a
>> WMI event, so the ACPI object passed to the WMI notify handler
>> can be NULL.
>>
>> Check for such a situation and ignore the event in such a case.
>>
>> Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> Applied.

Thank you.

Unfortunately patch 2/5 touches the same part of the file,
so I cannot apply the rest of the series without first
bringing this patch into platform-drivers-x86/for-next .

Guenter, can you provide an immutable branch/tag with
this patch on it; or drop this patch that I merge
the entire series through platform-drivers-x86/for-next ?

Regards,

Hans
Guenter Roeck Sept. 4, 2024, 6:38 p.m. UTC | #4
On 9/4/24 10:55, Hans de Goede wrote:
> Hi All,
> 
> On 9/2/24 4:28 PM, Guenter Roeck wrote:
>> On Sun, Sep 01, 2024 at 05:10:51AM +0200, Armin Wolf wrote:
>>> The BIOS can choose to return no event data in response to a
>>> WMI event, so the ACPI object passed to the WMI notify handler
>>> can be NULL.
>>>
>>> Check for such a situation and ignore the event in such a case.
>>>
>>> Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
>>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>>> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>>
>> Applied.
> 
> Thank you.
> 
> Unfortunately patch 2/5 touches the same part of the file,
> so I cannot apply the rest of the series without first
> bringing this patch into platform-drivers-x86/for-next .
> 
> Guenter, can you provide an immutable branch/tag with
> this patch on it; or drop this patch that I merge
> the entire series through platform-drivers-x86/for-next ?
> 

Can you wait a couple of days ? Since this is a bug fix, I had
planned to send a pull request either later today or; with that,
the patch would be upstream.

Guenter
Hans de Goede Sept. 4, 2024, 6:42 p.m. UTC | #5
Hi Guenter,

On 9/4/24 8:38 PM, Guenter Roeck wrote:
> On 9/4/24 10:55, Hans de Goede wrote:
>> Hi All,
>>
>> On 9/2/24 4:28 PM, Guenter Roeck wrote:
>>> On Sun, Sep 01, 2024 at 05:10:51AM +0200, Armin Wolf wrote:
>>>> The BIOS can choose to return no event data in response to a
>>>> WMI event, so the ACPI object passed to the WMI notify handler
>>>> can be NULL.
>>>>
>>>> Check for such a situation and ignore the event in such a case.
>>>>
>>>> Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
>>>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>>>> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>>>
>>> Applied.
>>
>> Thank you.
>>
>> Unfortunately patch 2/5 touches the same part of the file,
>> so I cannot apply the rest of the series without first
>> bringing this patch into platform-drivers-x86/for-next .
>>
>> Guenter, can you provide an immutable branch/tag with
>> this patch on it; or drop this patch that I merge
>> the entire series through platform-drivers-x86/for-next ?
>>
> 
> Can you wait a couple of days ? Since this is a bug fix, I had
> planned to send a pull request either later today or; with that,
> the patch would be upstream.

Yes I can wait a couple of days, thank you.

Regards,

Hans
Guenter Roeck Sept. 4, 2024, 7:40 p.m. UTC | #6
On 9/4/24 11:42, Hans de Goede wrote:
> Hi Guenter,
> 
> On 9/4/24 8:38 PM, Guenter Roeck wrote:
>> On 9/4/24 10:55, Hans de Goede wrote:
>>> Hi All,
>>>
>>> On 9/2/24 4:28 PM, Guenter Roeck wrote:
>>>> On Sun, Sep 01, 2024 at 05:10:51AM +0200, Armin Wolf wrote:
>>>>> The BIOS can choose to return no event data in response to a
>>>>> WMI event, so the ACPI object passed to the WMI notify handler
>>>>> can be NULL.
>>>>>
>>>>> Check for such a situation and ignore the event in such a case.
>>>>>
>>>>> Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
>>>>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>>>>> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>>>>
>>>> Applied.
>>>
>>> Thank you.
>>>
>>> Unfortunately patch 2/5 touches the same part of the file,
>>> so I cannot apply the rest of the series without first
>>> bringing this patch into platform-drivers-x86/for-next .
>>>
>>> Guenter, can you provide an immutable branch/tag with
>>> this patch on it; or drop this patch that I merge
>>> the entire series through platform-drivers-x86/for-next ?
>>>
>>
>> Can you wait a couple of days ? Since this is a bug fix, I had
>> planned to send a pull request either later today or; with that,
>> the patch would be upstream.
> 
> Yes I can wait a couple of days, thank you.
> 

I sent a pull request, and the patch is already upstream.

Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
index b5325d0e72b9..dfa1d6926dea 100644
--- a/drivers/hwmon/hp-wmi-sensors.c
+++ b/drivers/hwmon/hp-wmi-sensors.c
@@ -1637,6 +1637,8 @@  static void hp_wmi_notify(u32 value, void *context)
 		goto out_unlock;

 	wobj = out.pointer;
+	if (!wobj)
+		goto out_unlock;

 	err = populate_event_from_wobj(dev, &event, wobj);
 	if (err) {