[Intel-gfx] [PATCH i-g-t v4 3/6] tests/kms_ccs: Prevent segfault if pipe is not supported

Ben Widawsky ben at bwidawsk.net
Tue Oct 3 16:07:16 UTC 2017


On 17-09-27 15:34:16, Gabriel Krisman Bertazi wrote:
>for_each_plane_on_pipe() indexes bad memory when iterating over an invalid
>pipe.  Make sure the pipe exists before trying to use it.  This prevents
>the crash below:
>
>root at ideacentre:~# igt-gpu-tools/tests/kms_ccs --r pipe-D-crc-sprite-planes-basic
>IGT-Version: 1.19-g59f0e3d182a8 (x86_64) (Linux: 4.13.0-rc6.intel-boxes+x86_64)
>Received signal SIGSEGV.
>Stack trace:
> #0 [fatal_sig_handler+0x185]
> #1 [killpg+0x40]
> #2 [__real_main485+0x2de]
> #3 [main+0x3f]
> #4 [__libc_start_main+0xf1]
> #5 [_start+0x2a]
> #6 [<unknown>+0x2a]
>Subtest pipe-D-crc-sprite-planes-basic: CRASH (0.004s)
>
>Signed-off-by: Gabriel Krisman Bertazi <krisman at collabora.co.uk>

1-3 so far are
Reviewed-by: Ben Widawsky <ben at bwidawsk.net>

>---
> tests/kms_ccs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
>index 775c6999699f..73025a1e019f 100644
>--- a/tests/kms_ccs.c
>+++ b/tests/kms_ccs.c
>@@ -503,6 +503,9 @@ igt_main
>
> 		data.flags = TEST_CRC;
> 		igt_subtest_f("pipe-%s-crc-sprite-planes-basic", pipe_name) {
>+
>+			igt_display_require_output_on_pipe(&data.display, data.pipe);
>+
> 			for_each_plane_on_pipe(&data.display, data.pipe, data.plane) {
> 				if (data.plane->type == DRM_PLANE_TYPE_PRIMARY)
> 					continue;
>-- 
>2.11.0
>
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list