From af4031506aac35d06f5a057f4c96ffd57aeb21e8 Mon Sep 17 00:00:00 2001 From: Gabriel Krisman Bertazi Date: Wed, 15 Nov 2017 17:36:58 -0200 Subject: tests/kms_ccs: Prevent segfault if pipe is not supported 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@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 [+0x2a] Subtest pipe-D-crc-sprite-planes-basic: CRASH (0.004s) Signed-off-by: Gabriel Krisman Bertazi Reviewed-by: Arkadiusz Hiler Reviewed-by: Ben Widawsky --- tests/kms_ccs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/kms_ccs.c') diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c index 775c6999..73025a1e 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; -- cgit v1.2.3