Skip to contentSkip to conversation

drm/i915: Fix possible NULL pointer dereferences in i9xx_update_wm()

PATCH Superseded Harish Chegondi 3 participants 3 messages Dec 16, 2021 – Dec 17, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Fix possible NULL pointer dereferences in i9xx_update_wm()

Check return pointer from intel_crtc_for_plane() before dereferencing it, as it can be NULL.

Cc Jani Nikula <[email protected]>
Cc Caz Yokoyama <[email protected]>
Cc Radhakrishna Sripada <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
index bdf97a8c9ef3..c7a4d8d971d7 100644
@@ -2373,7 +2373,7 @@ static void i9xx_update_wm(struct drm_i915_private *dev_priv)
 	else
 		fifo_size = i9xx_get_fifo_size(dev_priv, PLANE_A);
 	crtc = intel_crtc_for_plane(dev_priv, PLANE_A);
-	if (intel_crtc_active(crtc)) {
+	if (crtc && intel_crtc_active(crtc)) {
 		const struct drm_display_mode *pipe_mode =
 			&crtc->config->hw.pipe_mode;
 		const struct drm_framebuffer *fb =
@@ -2403,7 +2403,7 @@ static void i9xx_update_wm(struct drm_i915_private *dev_priv)
 	else
 		fifo_size = i9xx_get_fifo_size(dev_priv, PLANE_B);
 	crtc = intel_crtc_for_plane(dev_priv, PLANE_B);
-	if (intel_crtc_active(crtc)) {
+	if (crtc && intel_crtc_active(crtc)) {
 		const struct drm_display_mode *pipe_mode =
 			&crtc->config->hw.pipe_mode;
 		const struct drm_framebuffer *fb =
Signature · 1 line
2.31.1
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Fix possible NULL pointer dereferences in i9xx_update_wm()

== Series Details ==

== Series Details ==

Series: drm/i915: Fix possible NULL pointer dereferences in i9xx_update_wm()
URL : https://patchwork.freedesktop.org/series/98154/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11009 -> Patchwork_21863
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_21863 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_21863, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/index.html

Participating hosts (43 -> 34)
------------------------------

Additional (1): fi-skl-guc
Missing (10): fi-bxt-dsi bat-dg1-6 bat-dg1-5 fi-icl-u2 fi-bsw-cyan bat-adlp-6 bat-adlp-4 fi-bdw-samus bat-jsl-2 bat-jsl-1

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_21863:

### IGT changes ###

#### Possible regressions ####

* igt@core_hotunplug@unbind-rebind:
- fi-blb-e6850: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11009/fi-blb-e6850/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-blb-e6850/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_selftest@live@execlists:
- {fi-jsl-1}: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11009/fi-jsl-1/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-jsl-1/igt@i915_selftest@[email protected]

Known issues
------------

Here are the changes found in Patchwork_21863 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_huc_copy@huc-copy:
- fi-skl-6600u: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#2190])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-6600u/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-skl-guc: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#4613]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-guc/igt@[email protected]

* igt@gem_lmem_swapping@verify-random:
- fi-skl-6600u: NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#4613]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-6600u/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: [PASS][8] -> [INCOMPLETE][9] ([i915#3303])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11009/fi-hsw-4770/igt@i915_selftest@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-hsw-4770/igt@i915_selftest@[email protected]
- fi-snb-2600: [PASS][10] -> [INCOMPLETE][11] ([i915#3921])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11009/fi-snb-2600/igt@i915_selftest@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-snb-2600/igt@i915_selftest@[email protected]

* igt@kms_chamelium@dp-crc-fast:
- fi-skl-guc: NOTRUN -> [SKIP][12] ([fdo#109271] / [fdo#111827]) +8 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-guc/igt@[email protected]

* igt@kms_chamelium@vga-edid-read:
- fi-skl-6600u: NOTRUN -> [SKIP][13] ([fdo#109271] / [fdo#111827]) +8 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-6600u/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-skl-guc: NOTRUN -> [SKIP][14] ([fdo#109271]) +28 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-guc/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-skl-6600u: NOTRUN -> [SKIP][15] ([fdo#109271]) +2 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-6600u/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-skl-6600u: NOTRUN -> [SKIP][16] ([fdo#109271] / [i915#533])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-6600u/igt@[email protected]
- fi-skl-guc: NOTRUN -> [SKIP][17] ([fdo#109271] / [i915#533])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-guc/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-skl-6600u: NOTRUN -> [FAIL][18] ([i915#4547])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-6600u/igt@kms_psr@primary_page_flip.html

* igt@runner@aborted:
- fi-hsw-4770: NOTRUN -> [FAIL][19] ([fdo#109271] / [i915#1436] / [i915#4312])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-hsw-4770/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s3:
- fi-tgl-1115g4: [FAIL][20] ([i915#1888]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11009/fi-tgl-1115g4/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-tgl-1115g4/igt@[email protected]

* igt@gem_flink_basic@bad-flink:
- fi-skl-6600u: [FAIL][22] ([i915#4547]) -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11009/fi-skl-6600u/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/fi-skl-6600u/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#3921]: https://gitlab.freedesktop.org/drm/intel/issues/3921
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533

Build changes
-------------

* Linux: CI_DRM_11009 -> Patchwork_21863

CI-20190529: 20190529
CI_DRM_11009: 9efbfd937cc876674559ddf8fb1897a00c10019b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6313: 1793ed798cc09966c27bf478781e0c1d6bb23bad @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21863: 00b81a40ee8733a6ddf0659ff7ef320440aa094b @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

00b81a40ee87 drm/i915: Fix possible NULL pointer dereferences in i9xx_update_wm()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21863/index.html

#2 lore raw
In reply to Harish Chegondi
Quoted 2 lines · Harish Chegondi

Check return pointer from intel_crtc_for_plane() before dereferencing it, as it can be NULL.

If you're doing this to satisfy some static analyzer, in these cases the code would read *much* better if you added the NULL check inside intel_crtc_active().

BR,
Jani.

Quoted 31 lines
Cc Jani Nikula <[email protected]>
Cc Caz Yokoyama <[email protected]>
Cc Radhakrishna Sripada <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
index bdf97a8c9ef3..c7a4d8d971d7 100644
@@ -2373,7 +2373,7 @@ static void i9xx_update_wm(struct drm_i915_private *dev_priv)
 	else
 		fifo_size = i9xx_get_fifo_size(dev_priv, PLANE_A);
 	crtc = intel_crtc_for_plane(dev_priv, PLANE_A);
-	if (intel_crtc_active(crtc)) {
+	if (crtc && intel_crtc_active(crtc)) {
 		const struct drm_display_mode *pipe_mode =
 			&crtc->config->hw.pipe_mode;
 		const struct drm_framebuffer *fb =
@@ -2403,7 +2403,7 @@ static void i9xx_update_wm(struct drm_i915_private *dev_priv)
 	else
 		fifo_size = i9xx_get_fifo_size(dev_priv, PLANE_B);
 	crtc = intel_crtc_for_plane(dev_priv, PLANE_B);
-	if (intel_crtc_active(crtc)) {
+	if (crtc && intel_crtc_active(crtc)) {
 		const struct drm_display_mode *pipe_mode =
 			&crtc->config->hw.pipe_mode;
 		const struct drm_framebuffer *fb =
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center