diff mbox series

[v2,10/15] media: atomisp: Don't try to parse unexpected ACPI object type

Message ID 20200626121925.14365-11-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series media: atomisp: Clean ups and fixes to make it load on Baytrail | expand

Commit Message

Andy Shevchenko June 26, 2020, 12:19 p.m. UTC
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>
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index fb61274af7e5..f06c0eb6d288 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -959,6 +959,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];