[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SA1PR19MB49263EE7ECF0D06962BE00ECFAB79@SA1PR19MB4926.namprd19.prod.outlook.com>
Date: Sun, 31 Jan 2021 14:04:07 +0000
From: "Limonciello, Mario" <Mario.Limonciello@...l.com>
To: Hans de Goede <hdegoede@...hat.com>,
Mark Gross <mgross@...ux.intel.com>
CC: LKML <linux-kernel@...r.kernel.org>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>
Subject: RE: [PATCH] platform/x86: dell-wmi-sysman: fix a NULL pointer
dereference
> -----Original Message-----
> From: Hans de Goede <hdegoede@...hat.com>
> Sent: Saturday, January 30, 2021 15:44
> To: Limonciello, Mario; Mark Gross
> Cc: LKML; platform-driver-x86@...r.kernel.org
> Subject: Re: [PATCH] platform/x86: dell-wmi-sysman: fix a NULL pointer
> dereference
>
>
> [EXTERNAL EMAIL]
>
> Hi,
>
> On 1/29/21 6:26 PM, Mario Limonciello wrote:
> > An upcoming Dell platform is causing a NULL pointer dereference
> > in dell-wmi-sysman initialization. Validate that the input from
> > BIOS matches correct ACPI types and abort module initialization
> > if it fails.
> >
> > This leads to a memory leak that needs to be cleaned up properly.
> >
> > Signed-off-by: Mario Limonciello <mario.limonciello@...l.com>
> > ---
> > drivers/platform/x86/dell-wmi-sysman/sysman.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/x86/dell-wmi-sysman/sysman.c
> b/drivers/platform/x86/dell-wmi-sysman/sysman.c
> > index dc6dd531c996..38b497991071 100644
> > --- a/drivers/platform/x86/dell-wmi-sysman/sysman.c
> > +++ b/drivers/platform/x86/dell-wmi-sysman/sysman.c
> > @@ -419,13 +419,19 @@ static int init_bios_attributes(int attr_type, const
> char *guid)
> > return retval;
> > /* need to use specific instance_id and guid combination to get right
> data */
> > obj = get_wmiobj_pointer(instance_id, guid);
> > - if (!obj)
> > + if (!obj || obj->type != ACPI_TYPE_PACKAGE) {
> > + release_attributes_data();
>
> All calls of init_bios_attributes() have the following error handling:
>
> ret = init_bios_attributes(INT, DELL_WMI_BIOS_INTEGER_ATTRIBUTE_GUID);
> if (ret) {
> pr_debug("failed to populate integer type attributes\n");
> goto fail_create_group;
> }
>
> ...
>
> fail_create_group:
> release_attributes_data();
>
> So that added release_attributes_data() call is not necessary. If you can
> respin
> this patch Monday with the release_attributes_data(); addition dropped, then
> I will try to get this to Linus in time for 5.11 .
>
> Or I can fix this up locally if you agree with dropping the unnecessary
> release_attributes_data() call.
>
Yes, please go ahead and drop the unnecessary call locally.
Thank you
> Regards,
>
> Hans
>
>
>
>
> > return -ENODEV;
> > + }
> > elements = obj->package.elements;
> >
> > mutex_lock(&wmi_priv.mutex);
> > while (elements) {
> > /* sanity checking */
> > + if (elements[ATTR_NAME].type != ACPI_TYPE_STRING) {
> > + pr_debug("incorrect element type\n");
> > + goto nextobj;
> > + }
> > if (strlen(elements[ATTR_NAME].string.pointer) == 0) {
> > pr_debug("empty attribute found\n");
> > goto nextobj;
> >
Powered by blists - more mailing lists