drm/i915: Fix invalid access to ACPI _DSM objects
authorTakashi Iwai <tiwai@suse.de>
Fri, 2 Apr 2021 08:23:17 +0000 (10:23 +0200)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Wed, 7 Apr 2021 23:07:44 +0000 (19:07 -0400)
commitb6a37a93c9ac3900987c79b726d0bb3699d8db4e
tree6d60bd59478bb8d48d5313dd3a16902b373e3d8a
parente49d033bddf5b565044e2abe4241353959bc9120
drm/i915: Fix invalid access to ACPI _DSM objects

intel_dsm_platform_mux_info() tries to parse the ACPI package data
from _DSM for the debug information, but it assumes the fixed format
without checking what values are stored in the elements actually.
When an unexpected value is returned from BIOS, it may lead to GPF or
NULL dereference, as reported recently.

Add the checks of the contents in the returned values and skip the
values for invalid cases.

v1->v2: Check the info contents before dereferencing, too

BugLink: http://bugzilla.opensuse.org/show_bug.cgi?id=1184074
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210402082317.871-1-tiwai@suse.de
(cherry picked from commit 337d7a1621c7f02af867229990ac67c97da1b53a)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/display/intel_acpi.c