lkml.org 
[lkml]   [2021]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] platform/x86: dell-wmi-sysman: fix a NULL pointer dereference
Date
> -----Original Message-----
> From: Limonciello, Mario <Mario_Limonciello@Dell.com>
> Sent: 2021年1月30日 1:29
> To: Hans De Goede; Mark Gross
> Cc: LKML; platform-driver-x86@vger.kernel.org; Bharathi, Divya; Ksr, Prasanth;
> Yuan, Perry
> Subject: RE: [PATCH] platform/x86: dell-wmi-sysman: fix a NULL pointer
> dereference
>
> +Divya, +Prasanth, +Perry
>
> > -----Original Message-----
> > From: Limonciello, Mario <Mario_Limonciello@Dell.com>
> > Sent: Friday, January 29, 2021 11:27
> > To: Hans De Goede; Mark Gross
> > Cc: LKML; platform-driver-x86@vger.kernel.org; Limonciello, Mario
> > Subject: [PATCH] platform/x86: dell-wmi-sysman: fix a NULL pointer
> > dereference
> >
> > 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@dell.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();
> > 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;
> > --
> > 2.25.1

Tested on the Dell laptop system which I found the issue.
Kernel can boot up with this new fix patch without any panic triggered.

Tested-by: Perry Yuan <perry_yuan@dell.com>
\
 
 \ /
  Last update: 2021-01-30 06:42    [W:0.135 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site