From patchwork Thu Aug 31 06:18:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 9931249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 71170602F0 for ; Thu, 31 Aug 2017 06:19:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6899328793 for ; Thu, 31 Aug 2017 06:19:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D979287E9; Thu, 31 Aug 2017 06:19:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0771528793 for ; Thu, 31 Aug 2017 06:19:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 866386E69E; Thu, 31 Aug 2017 06:19:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4865A6E69E for ; Thu, 31 Aug 2017 06:19:15 +0000 (UTC) Received: from localhost (unknown [IPv6:2a00:5f00:102:0:8c39:81ff:fe68:83db]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 7E32A261417; Thu, 31 Aug 2017 07:19:13 +0100 (BST) From: Gabriel Krisman Bertazi To: intel-gfx@lists.freedesktop.org Date: Thu, 31 Aug 2017 03:18:06 -0300 Message-Id: <20170831061810.11773-4-krisman@collabora.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170831061810.11773-1-krisman@collabora.co.uk> References: <20170831061810.11773-1-krisman@collabora.co.uk> Cc: daniel.vetter@intel.com, daniels@collabora.com, tomeu.vizoso@collabora.com Subject: [Intel-gfx] [PATCH i-g-t v3 3/7] tests/kms_ccs: Prevent segfault if pipe is not supported X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;