drm/i915: Fix invalid access to ACPI _DSM objects
Subsystems (3)
PATCH 1/1 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.
--- drivers/gpu/drm/i915/display/intel_acpi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/i915/display/intel_acpi.c +12 -0
@@ -84,6 +84,11 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle)return ; } +if (!pkg->package.count) { +DRM_DEBUG_DRIVER ("no connection in _DSM\n" ); +return ; + } + connector_count = &pkg->package.elements[0 ];DRM_DEBUG_DRIVER ("MUX info connectors: %lld\n" , (unsigned long long )connector_count->integer.value);
@@ -91,6 +96,13 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle)union acpi_object *obj = &pkg->package.elements[i];union acpi_object *connector_id = &obj->package.elements[0 ];union acpi_object *info = &obj->package.elements[1 ]; + +if (obj->type !=ACPI_TYPE_PACKAGE || obj->package.count <2 || + info->type !=ACPI_TYPE_BUFFER || info->buffer.length <4 ) { +DRM_DEBUG_DRIVER ("Invalid object for MUX #%d\n" , i); +continue ; + } +DRM_DEBUG_DRIVER ("Connector id: 0x%016llx\n" , (unsigned long long )connector_id->integer.value); DRM_DEBUG_DRIVER(" port id: %s\n",
Signature · 6 lines
2.26.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915: Fix invalid access to ACPI _DSM objects
== Series Details ==
== Series Details ==
Series: drm/i915: Fix invalid access to ACPI _DSM objects
URL : https://patchwork.freedesktop.org/series/88685/
State : warning
== Summary ==
$ make htmldocs 2>&1 > /dev/null | grep i915 ./drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:102: warning: Function parameter or member 'ww' not described in 'i915_gem_shrink' ./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Excess function parameter 'trampoline' description in 'intel_engine_cmd_parser' ./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Function parameter or member 'jump_whitelist' not described in 'intel_engine_cmd_parser' ./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Function parameter or member 'shadow_map' not described in 'intel_engine_cmd_parser' ./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Function parameter or member 'batch_map' not described in 'intel_engine_cmd_parser' ./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Excess function parameter 'trampoline' description in 'intel_engine_cmd_parser'
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Takashi Iwai
intel_dsm_platform_mux_info()tries to parse the ACPI package data from_DSMfor 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.
Quoted 6 lines
Add the checks of the contents in the returned values and skip the values for invalid cases.
Cc <[email protected]>Signed-off-by Takashi Iwai <[email protected]>
Scratch this one. I sent an older version mistakenly. Will resubmit the right one.
Takashi
Quoted 37 lines
--- drivers/gpu/drm/i915/display/intel_acpi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/gpu/drm/i915/display/intel_acpi.c +12
-0@@ -84,6 +84,11 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle)return ; } +if (!pkg->package.count) { +DRM_DEBUG_DRIVER ("no connection in _DSM\n" ); +return ; + } + connector_count = &pkg->package.elements[0 ];DRM_DEBUG_DRIVER ("MUX info connectors: %lld\n" , (unsigned long long )connector_count->integer.value);@@ -91,6 +96,13 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle)union acpi_object *obj = &pkg->package.elements[i];union acpi_object *connector_id = &obj->package.elements[0 ];union acpi_object *info = &obj->package.elements[1 ]; + +if (obj->type !=ACPI_TYPE_PACKAGE || obj->package.count <2 || + info->type !=ACPI_TYPE_BUFFER || info->buffer.length <4 ) { +DRM_DEBUG_DRIVER ("Invalid object for MUX #%d\n" , i); +continue ; + } +DRM_DEBUG_DRIVER ("Connector id: 0x%016llx\n" , (unsigned long long )connector_id->integer.value); DRM_DEBUG_DRIVER(" port id: %s\n",Signature · 1 line
2.26.2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Fix invalid access to ACPI _DSM objects
In reply to Takashi Iwai== Series Details ==
== Series Details ==
Series: drm/i915: Fix invalid access to ACPI _DSM objects
URL : https://patchwork.freedesktop.org/series/88685/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_9926 -> Patchwork_19891
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19891/index.html
Known issues
------------
Here are the changes found in Patchwork_19891 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@hangcheck:
- fi-snb-2600: [PASS][1] -> [INCOMPLETE][2] ([i915#2782])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9926/fi-snb-2600/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19891/fi-snb-2600/igt@i915_selftest@[email protected]
#### Possible fixes ####
* igt@gem_ringfill@basic-all:
- fi-tgl-y: [DMESG-WARN][3] ([i915#402]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9926/fi-tgl-y/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19891/fi-tgl-y/igt@[email protected]
* igt@i915_pm_rpm@module-reload:
- fi-kbl-soraka: [DMESG-WARN][5] ([i915#1982]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9926/fi-kbl-soraka/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19891/fi-kbl-soraka/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
Participating hosts (47 -> 39)
------------------------------
Missing (8): fi-ilk-m540 fi-tgl-u2 fi-hsw-4200u fi-bsw-n3050 fi-bsw-cyan fi-ctg-p8600 fi-bsw-kefka fi-bdw-samus
Build changes
-------------
* Linux: CI_DRM_9926 -> Patchwork_19891
CI-20190529: 20190529
CI_DRM_9926: c73cd6993305be64f07fc110883a12025ce3d3d3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6056: 84e6a7e19ccc7fafc46f372e756cad9d4aa093f7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19891: 666f62ea73ae0c6839fce429ae245506c3650fd5 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
666f62ea73ae drm/i915: Fix invalid access to ACPI _DSM objects
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19891/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx