summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-06-26 14:19:20 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-07-18 07:22:02 +0200
commit0f46ab461e3a15ba6f9c5e0c12233b3339abc42e (patch)
treefa1ab8f54b127bf57506fecf4f7d24763e209b50
parent96310fd873897dc08274f4dfd6f8a5c3e009a5a4 (diff)
media: atomisp: Don't try to parse unexpected ACPI object type
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>
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 5c082fd3517f..164f02820ae4 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -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];