From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
corentin.chary@gmail.com, luke@ljones.dev,
"Hans de Goede" <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5] platform/x86: wmi: Check if event data is not NULL
Date: Mon, 19 Feb 2024 13:57:01 +0200 (EET) [thread overview]
Message-ID: <1fb172ff-b085-185e-90ea-1cd131f42b84@linux.intel.com> (raw)
In-Reply-To: <80bc19ce-7111-4a5d-b875-2712bdf2bb72@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 2578 bytes --]
On Thu, 15 Feb 2024, Armin Wolf wrote:
> Am 15.02.24 um 13:31 schrieb Ilpo Järvinen:
>
> > On Wed, 14 Feb 2024, Armin Wolf wrote:
> >
> > > WMI event drivers which do not have no_notify_data set expect
> > > that each WMI event contains valid data. Evaluating _WED however
> > > might return no data, which can cause issues with such drivers.
> > >
> > > Fix this by validating that evaluating _WED did return data.
> > >
> > > Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> > > ---
> > > drivers/platform/x86/wmi.c | 11 +++++++++--
> > > 1 file changed, 9 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> > > index 34d8f55afaad..8a916887c546 100644
> > > --- a/drivers/platform/x86/wmi.c
> > > +++ b/drivers/platform/x86/wmi.c
> > > @@ -1211,6 +1211,7 @@ static void wmi_notify_driver(struct wmi_block
> > > *wblock)
> > > {
> > > struct wmi_driver *driver = drv_to_wdrv(wblock->dev.dev.driver);
> > > struct acpi_buffer data = { ACPI_ALLOCATE_BUFFER, NULL };
> > > + union acpi_object *obj = NULL;
> > > acpi_status status;
> > >
> > > if (!driver->no_notify_data) {
> > > @@ -1219,12 +1220,18 @@ static void wmi_notify_driver(struct wmi_block
> > > *wblock)
> > > dev_warn(&wblock->dev.dev, "Failed to get event
> > > data\n");
> > > return;
> > > }
> > > +
> > > + obj = data.pointer;
> > > + if (!obj) {
> > > + dev_warn(&wblock->dev.dev, "Event contains not event
> > > data\n");
> > > + return;
> > > + }
> > > }
> > >
> > > if (driver->notify)
> > > - driver->notify(&wblock->dev, data.pointer);
> > > + driver->notify(&wblock->dev, obj);
> > >
> > > - kfree(data.pointer);
> > > + kfree(obj);
> > Hi Armin,
> >
> > While looking into this patch, I failed to connect the mention of
> > no_notify_data in the commit message with the code change that does
> > nothing differently based no_notify_data being set or not, AFAICT.
> >
> > It could be just that you need to explain things better in the commit
> > message, I'm not sure.
>
> Here the _WED ACPI control method is only evaluated if driver->no_notify_data
> is not set.
> So the returned ACPI object should only be validated in this case, as we pass
> NULL otherwise.
Yes, I'm sorry, it seems fine. For some reason I was very confused while
reviewing even if no_notify_data was mentioned right in the previous
context (maybe Iused some older version of the code while trying to figure
things out, I dunno).
--
i.
next prev parent reply other threads:[~2024-02-19 11:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 7:04 [PATCH 0/5] platform/x86: wmi: Fixes for event data handling Armin Wolf
2024-02-14 7:04 ` [PATCH 1/5] platform/x86: wmi: Prevent incompatible event driver from probing Armin Wolf
2024-02-15 12:32 ` Ilpo Järvinen
2024-02-14 7:04 ` [PATCH 2/5] platform/x86: wmi: Check if event data is not NULL Armin Wolf
2024-02-15 12:31 ` Ilpo Järvinen
2024-02-15 20:27 ` Armin Wolf
2024-02-19 11:57 ` Ilpo Järvinen [this message]
2024-02-14 7:04 ` [PATCH 3/5] platform/x86: wmi: Always evaluate _WED when receiving an event Armin Wolf
2024-02-14 7:04 ` [PATCH 4/5] platform/x86: wmi: Update documentation regarding _WED Armin Wolf
2024-02-14 7:04 ` [PATCH 5/5] Revert "platform/x86: asus-wmi: Support WMI event queue" Armin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1fb172ff-b085-185e-90ea-1cd131f42b84@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=W_Armin@gmx.de \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome