media: atomisp: Don't try to parse unexpected ACPI object type
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 26 Jun 2020 12:19:20 +0000 (14:19 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 18 Jul 2020 05:22:02 +0000 (07:22 +0200)
There are devices with completely different _DSM() format,
and accessing object as a package leads to crashes.

Bail out in the case of unexpected object type.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c

index 5c082fd..164f028 100644 (file)
@@ -1134,6 +1134,10 @@ static int gmin_get_config_dsm_var(struct device *dev,
                return -EINVAL;
        }
 
+       /* Return on unexpected object type */
+       if (obj->type != ACPI_TYPE_PACKAGE)
+               return -EINVAL;
+
 #if 0 /* Just for debugging purposes */
        for (i = 0; i < obj->package.count; i++) {
                union acpi_object *cur = &obj->package.elements[i];