Skip to contentSkip to conversation

drm: Check if primary mst is null

PATCH In review Stanislav Lisovskiy 3 participants 5 messages Nov 9, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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, 108616 bugs which crash in drm_dp_get_mst_branch_device, caused by this issue.

v2: Refactored the code, as it was nicely noticed.
Fixed Bugzilla bug numbers(second was 108616, but not 108816) and added links.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108616
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107738

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
index 5ff1d79b86c4..0e0df398222d 100644
@@ -1275,6 +1275,9 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
 	mutex_lock(&mgr->lock);
 	mstb = mgr->mst_primary;
 
+	if (!mstb)
+		goto out;
+
 	for (i = 0; i < lct - 1; i++) {
 		int shift = (i % 2) ? 0 : 4;
 		int port_num = (rad[i / 2] >> shift) & 0xf;
Signature · 6 lines
2.17.1

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

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

== Series Details ==

== Series Details ==

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

== Summary ==

= CI Bug Log - changes from CI_DRM_5109 -> Patchwork_10788 =

== Summary - SUCCESS ==

No regressions found.

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

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_flip@basic-flip-vs-modeset:
      fi-hsw-4770r:       PASS -> DMESG-WARN (fdo#105602)

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

    
    ==== Possible fixes ====

    igt@drv_selftest@live_contexts:
      fi-bsw-n3050:       DMESG-FAIL (fdo#108626) -> PASS

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

    igt@kms_chamelium@common-hpd-after-suspend:
      fi-skl-6700k2:      WARN (fdo#108680) -> PASS

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> PASS

fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#108626 https://bugs.freedesktop.org/show_bug.cgi?id=108626
fdo#108680 https://bugs.freedesktop.org/show_bug.cgi?id=108680

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

Additional (1): fi-pnv-d510
Missing (8): fi-kbl-soraka 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_5109 -> Patchwork_10788

CI_DRM_5109: fd007cc63a9d60ac2a6f966a3c790e710aa8ca94 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10788: be7a48dc82d53cbb027ec5b29d33e590535f96a1 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

be7a48dc82d5 drm: Check if primary mst is null

== Logs ==

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

#2 lore raw

✗ Fi.CI.IGT: failure for drm: Check if primary mst is null (rev3)

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: drm: Check if primary mst is null (rev3)
URL : https://patchwork.freedesktop.org/series/52174/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_5109_full -> Patchwork_10788_full =

== Summary - FAILURE ==

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10788_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_10788_full:

=== IGT changes ===

    ==== Possible regressions ====

    igt@kms_flip@flip-vs-fences:
      shard-apl:          PASS -> DMESG-WARN

    igt@perf_pmu@cpu-hotplug:
      shard-apl:          PASS -> TIMEOUT

    
    ==== Warnings ====

    igt@kms_atomic_transition@plane-use-after-nonblocking-unbind-fencing:
      shard-snb:          PASS -> SKIP +4

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

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_pwrite_pread@display-pwrite-blt-gtt_mmap-performance:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@gem_softpin@noreloc-s3:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
      shard-glk:          NOTRUN -> DMESG-WARN (fdo#107956) +2

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
      shard-kbl:          NOTRUN -> DMESG-WARN (fdo#107956)

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

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

    igt@kms_cursor_crc@cursor-256x85-onscreen:
      shard-glk:          NOTRUN -> FAIL (fdo#103232) +1

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

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

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

    igt@kms_plane@plane-position-covered-pipe-c-planes:
      shard-glk:          NOTRUN -> FAIL (fdo#103166) +1

    igt@kms_plane_alpha_blend@pipe-c-alpha-transparant-fb:
      shard-glk:          NOTRUN -> FAIL (fdo#108145) +6

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

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

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          INCOMPLETE (fdo#103665, fdo#106023, fdo#106887) -> PASS

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

    igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
      shard-glk:          FAIL (fdo#108145) -> PASS

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

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

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#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106887 https://bugs.freedesktop.org/show_bug.cgi?id=106887
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

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

Missing (1): shard-skl

== Build changes ==

* Linux: CI_DRM_5109 -> Patchwork_10788

CI_DRM_5109: fd007cc63a9d60ac2a6f966a3c790e710aa8ca94 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10788: be7a48dc82d53cbb027ec5b29d33e590535f96a1 @ 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_10788/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✗ Fi.CI.IGT: failure for drm: Check if primary mst is null (rev3)

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: drm: Check if primary mst is null (rev3)
URL : https://patchwork.freedesktop.org/series/52174/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_5109_full -> Patchwork_10788_full =

== Summary - FAILURE ==

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10788_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_10788_full:

=== IGT changes ===

    ==== Possible regressions ====

    igt@kms_flip@flip-vs-fences:
      shard-apl:          PASS -> DMESG-WARN

    igt@perf_pmu@cpu-hotplug:
      shard-apl:          PASS -> TIMEOUT

    
    ==== Warnings ====

    igt@kms_atomic_transition@plane-use-after-nonblocking-unbind-fencing:
      shard-snb:          PASS -> SKIP +4

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

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_pwrite_pread@display-pwrite-blt-gtt_mmap-performance:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@gem_softpin@noreloc-s3:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
      shard-glk:          NOTRUN -> DMESG-WARN (fdo#107956) +2

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
      shard-kbl:          NOTRUN -> DMESG-WARN (fdo#107956)

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

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

    igt@kms_cursor_crc@cursor-256x85-onscreen:
      shard-glk:          NOTRUN -> FAIL (fdo#103232) +1

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

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

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

    igt@kms_plane@plane-position-covered-pipe-c-planes:
      shard-glk:          NOTRUN -> FAIL (fdo#103166) +1

    igt@kms_plane_alpha_blend@pipe-c-alpha-transparant-fb:
      shard-glk:          NOTRUN -> FAIL (fdo#108145) +6

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

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

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          INCOMPLETE (fdo#106023, fdo#103665, fdo#106887) -> PASS

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

    igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
      shard-glk:          FAIL (fdo#108145) -> PASS

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

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

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#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106887 https://bugs.freedesktop.org/show_bug.cgi?id=106887
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

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

Missing (1): shard-skl

== Build changes ==

* Linux: CI_DRM_5109 -> Patchwork_10788

CI_DRM_5109: fd007cc63a9d60ac2a6f966a3c790e710aa8ca94 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10788: be7a48dc82d53cbb027ec5b29d33e590535f96a1 @ 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_10788/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
In reply to Stanislav Lisovskiy

Pushed with small changes to drm-misc-fixes: Renamed patch and added stable Cc

Thanks!

Quoted 38 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, 108616 bugs which crash in drm_dp_get_mst_branch_device, caused by this issue.

v2: Refactored the code, as it was nicely noticed.
Fixed Bugzilla bug numbers(second was 108616, but not 108816) and added links.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108616
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107738

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
index 5ff1d79b86c4..0e0df398222d 100644
@@ -1275,6 +1275,9 @@ static struct drm_dp_mst_branch
 *drm_dp_get_mst_branch_device(struct drm_dp_mst_
 	mutex_lock(&mgr->lock);
 	mstb = mgr->mst_primary;
 
+	if (!mstb)
+		goto out;
+
 	for (i = 0; i < lct - 1; i++) {
 		int shift = (i % 2) ? 0 : 4;

int port_num = (rad[i / 2] >> shift) & 0xf;

Signature · 2 lines
Cheers,
	Lyude Paul