Skip to contentSkip to conversation

drm: Check if primary mst is null

PATCH Superseded Stanislav Lisovskiy 4 participants 6 messages Nov 7, 2018 – Nov 8, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Check if primary mst is null

Unfortunately drm_dp_get_mst_branch_device which is called from both drm_dp_mst_handle_down_rep and drm_dp_mst_handle_up_rep seem to rely on that mgr->mst_primary is not NULL, which seem to be wrong as it can be cleared with simultaneous mode set, if probing fails or in other case. mgr->lock mutex doesn't protect against that as it might just get assigned to NULL right before, not simultaneously.
There are currently bugs 107738, 108816 bugs which crash in drm_dp_get_mst_branch_device, caused by this issue.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +6 -0
index 5ff1d79b86c4..fb90ed4cdc3a 100644
@@ -1273,6 +1273,12 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
 	/* find the port by iterating down */
 
 	mutex_lock(&mgr->lock);
+
+	if (!mgr->mst_primary) {
+		mstb = NULL;
+		goto out;
+	}
+
 	mstb = mgr->mst_primary;
 
 	for (i = 0; i < lct - 1; i++) {
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

✗ Fi.CI.CHECKPATCH: warning for drm: Check if primary mst is null

== Series Details ==

== Series Details ==

Series: drm: Check if primary mst is null
URL : https://patchwork.freedesktop.org/series/52174/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
f8a61b5fe3ea drm: Check if primary mst is null
-:10: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#10: 
mgr->lock mutex doesn't protect against that as it might just get assigned to NULL

total: 0 errors, 1 warnings, 0 checks, 12 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Stanislav Lisovskiy
Quoted 8 lines · Stanislav Lisovskiy

Unfortunately drm_dp_get_mst_branch_device which is called from both drm_dp_mst_handle_down_rep and drm_dp_mst_handle_up_rep seem to rely on that mgr->mst_primary is not NULL, which seem to be wrong as it can be cleared with simultaneous mode set, if probing fails or in other case. mgr->lock mutex doesn't protect against that as it might just get assigned to NULL right before, not simultaneously.
There are currently bugs 107738, 108816 bugs which crash in drm_dp_get_mst_branch_device, caused by this issue.

Use the proper Bugzilla: tags for those. This also seems like cc:stable material.

Quoted 12 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 5ff1d79b86c4..fb90ed4cdc3a 100644
@@ -1273,6 +1273,12 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
 	/* find the port by iterating down */

drivers/gpu/drm/drm_dp_mst_topology.c static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ · line 1283

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +6 -0
 
 	mutex_lock(&mgr->lock);
+
+	if (!mgr->mst_primary) {
+		mstb = NULL;
+		goto out;
+	}
+
 	mstb = mgr->mst_primary;
 

Or a bit simpler:

mstb = mgr->mst_primary;
+ if (!mstb)
+ goto out;

ccing Lyude as well..

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 	for (i = 0; i < lct - 1; i++) {
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

✓ Fi.CI.BAT: success for drm: Check if primary mst is null

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: drm: Check if primary mst is null
URL : https://patchwork.freedesktop.org/series/52174/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5098 -> Patchwork_10755 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/52174/revisions/1/mbox/

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_module_reload@basic-reload:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    igt@gem_exec_suspend@basic-s3:
      fi-cfl-8109u:       PASS -> INCOMPLETE (fdo#108126, fdo#107187)

    
    ==== Possible fixes ====

    igt@kms_frontbuffer_tracking@basic:
      fi-icl-u2:          FAIL (fdo#103167) -> PASS

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
      fi-ilk-650:         DMESG-WARN (fdo#106387) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#107362) -> PASS

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
fdo#107187 https://bugs.freedesktop.org/show_bug.cgi?id=107187
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#108126 https://bugs.freedesktop.org/show_bug.cgi?id=108126

== Participating hosts (52 -> 46) ==

Additional (1): fi-byt-j1900
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-snb-2520m fi-ctg-p8600 fi-icl-u

== Build changes ==

* Linux: CI_DRM_5098 -> Patchwork_10755

CI_DRM_5098: a9cbcae14226206fe08f3c1e3f74ad9e357a4384 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4712: a3ede1b535ac8137f6949c468edd7054453d5dae @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10755: f8a61b5fe3ea6b61fbd57bf3eaa02a40e1953f5d @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

f8a61b5fe3ea drm: Check if primary mst is null

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10755/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#4 lore raw
In reply to Stanislav Lisovskiy

Thanks for noticing this one! With the changes that Ville mentioned in their response:

If you need me to push this for you; poke me here or on IRC

Quoted 34 lines · Stanislav Lisovskiy

Unfortunately drm_dp_get_mst_branch_device which is called from both drm_dp_mst_handle_down_rep and drm_dp_mst_handle_up_rep seem to rely on that mgr->mst_primary is not NULL, which seem to be wrong as it can be cleared with simultaneous mode set, if probing fails or in other case. mgr->lock mutex doesn't protect against that as it might just get assigned to NULL
right before, not simultaneously.
There are currently bugs 107738, 108816 bugs which crash in drm_dp_get_mst_branch_device, caused by this issue.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +6 -0
index 5ff1d79b86c4..fb90ed4cdc3a 100644
@@ -1273,6 +1273,12 @@ static struct drm_dp_mst_branch
 *drm_dp_get_mst_branch_device(struct drm_dp_mst_
 	/* find the port by iterating down */
 
 	mutex_lock(&mgr->lock);
+
+	if (!mgr->mst_primary) {
+		mstb = NULL;
+		goto out;
+	}
+
 	mstb = mgr->mst_primary;
 

for (i = 0; i < lct - 1; i++) {

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

✓ Fi.CI.IGT: success for drm: Check if primary mst is null

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: drm: Check if primary mst is null
URL : https://patchwork.freedesktop.org/series/52174/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5098_full -> Patchwork_10755_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_10755_full need to be verified manually.

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

== Possible new issues ==

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

=== IGT changes ===

    ==== Warnings ====

    igt@drm_read@short-buffer-nonblock:
      shard-snb:          PASS -> SKIP

    igt@kms_plane@plane-position-covered-pipe-b-planes:
      shard-snb:          SKIP -> PASS +3

    igt@perf_pmu@rc6:
      shard-kbl:          SKIP -> PASS

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_schedule@pi-ringfull-blt:
      shard-skl:          NOTRUN -> FAIL (fdo#103158)

    igt@gem_exec_schedule@pi-ringfull-vebox:
      shard-apl:          NOTRUN -> FAIL (fdo#103158)

    igt@kms_busy@extended-modeset-hang-newfb-render-a:
      shard-skl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_busy@extended-pageflip-hang-newfb-render-a:
      shard-apl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_chv_cursor_fail@pipe-a-256x256-right-edge:
      shard-skl:          PASS -> FAIL (fdo#104671)

    igt@kms_chv_cursor_fail@pipe-a-64x64-right-edge:
      shard-skl:          NOTRUN -> FAIL (fdo#104671)

    igt@kms_color@pipe-b-ctm-blue-to-red:
      shard-skl:          PASS -> FAIL (fdo#107201)

    igt@kms_color@pipe-b-legacy-gamma:
      shard-apl:          PASS -> FAIL (fdo#104782)

    igt@kms_cursor_crc@cursor-128x128-dpms:
      shard-skl:          NOTRUN -> FAIL (fdo#103232) +3

    igt@kms_cursor_crc@cursor-256x256-suspend:
      shard-apl:          PASS -> FAIL (fdo#103232, fdo#103191)

    igt@kms_cursor_crc@cursor-size-change:
      shard-apl:          PASS -> FAIL (fdo#103232)

    igt@kms_fbcon_fbt@fbc-suspend:
      shard-skl:          PASS -> INCOMPLETE (fdo#104108, fdo#107773)

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#105363, fdo#102887)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
      shard-apl:          PASS -> FAIL (fdo#103167) +2

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
      shard-glk:          PASS -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-blt:
      shard-skl:          NOTRUN -> FAIL (fdo#105682)

    igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-mmap-wc:
      shard-skl:          PASS -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-pri-shrfb-draw-mmap-gtt:
      shard-snb:          SKIP -> INCOMPLETE (fdo#105411)

    igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-wc:
      shard-skl:          NOTRUN -> FAIL (fdo#103167)

    igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
      shard-skl:          PASS -> INCOMPLETE (fdo#104108)

    igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
      shard-glk:          PASS -> FAIL (fdo#108145)

    igt@kms_plane_alpha_blend@pipe-b-alpha-basic:
      shard-skl:          NOTRUN -> FAIL (fdo#107815, fdo#108145) +1

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-glk:          PASS -> FAIL (fdo#103166)

    igt@perf@polling:
      shard-hsw:          PASS -> FAIL (fdo#102252)

    
    ==== Possible fixes ====

    igt@gem_exec_reuse@baggage:
      shard-apl:          DMESG-WARN -> PASS

    igt@kms_busy@extended-modeset-hang-newfb-render-a:
      shard-kbl:          DMESG-WARN (fdo#107956) -> PASS

    igt@kms_color@pipe-b-ctm-max:
      shard-apl:          FAIL (fdo#108147) -> PASS

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-skl:          INCOMPLETE (fdo#104108) -> PASS +1

    igt@kms_cursor_crc@cursor-256x85-onscreen:
      shard-apl:          FAIL (fdo#103232) -> PASS +4

    igt@kms_cursor_crc@cursor-64x21-offscreen:
      shard-apl:          INCOMPLETE (fdo#103927) -> PASS

    igt@kms_cursor_crc@cursor-64x64-random:
      shard-glk:          FAIL (fdo#103232) -> PASS

    igt@kms_cursor_legacy@cursorb-vs-flipb-varying-size:
      shard-glk:          DMESG-WARN (fdo#106538, fdo#105763) -> PASS +1

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-apl:          FAIL (fdo#105363, fdo#102887) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-fullscreen:
      shard-apl:          FAIL (fdo#103167) -> PASS

    igt@kms_frontbuffer_tracking@psr-farfromfence:
      shard-apl:          INCOMPLETE (fdo#103927) -> SKIP

    igt@kms_plane@plane-position-covered-pipe-b-planes:
      shard-glk:          FAIL (fdo#103166) -> PASS

    igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
      shard-skl:          FAIL (fdo#107815) -> PASS

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-apl:          FAIL (fdo#103166) -> PASS +3

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> PASS

    igt@pm_rpm@gem-execbuf-stress-extra-wait:
      shard-skl:          INCOMPLETE (fdo#107807, fdo#107803) -> PASS

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104671 https://bugs.freedesktop.org/show_bug.cgi?id=104671
fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105682 https://bugs.freedesktop.org/show_bug.cgi?id=105682
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#107201 https://bugs.freedesktop.org/show_bug.cgi?id=107201
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107803 https://bugs.freedesktop.org/show_bug.cgi?id=107803
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107815 https://bugs.freedesktop.org/show_bug.cgi?id=107815
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#108147 https://bugs.freedesktop.org/show_bug.cgi?id=108147
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (6 -> 6) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_5098 -> Patchwork_10755

CI_DRM_5098: a9cbcae14226206fe08f3c1e3f74ad9e357a4384 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4712: a3ede1b535ac8137f6949c468edd7054453d5dae @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10755: f8a61b5fe3ea6b61fbd57bf3eaa02a40e1953f5d @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10755/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx