From patchwork Thu Aug 31 05:58:14 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: 9931217 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 D71D160362 for ; Thu, 31 Aug 2017 05:58:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA62928846 for ; Thu, 31 Aug 2017 05:58:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF0702884A; Thu, 31 Aug 2017 05:58:50 +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 72B7428854 for ; Thu, 31 Aug 2017 05:58:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54EFE6E691; Thu, 31 Aug 2017 05:58:44 +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 E11516E691 for ; Thu, 31 Aug 2017 05:58:42 +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 49FA8269EA8; Thu, 31 Aug 2017 06:58:41 +0100 (BST) From: Gabriel Krisman Bertazi To: intel-gfx@lists.freedesktop.org Date: Thu, 31 Aug 2017 02:58:14 -0300 Message-Id: <20170831055818.11796-4-krisman@collabora.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170831055818.11796-1-krisman@collabora.co.uk> References: <20170831055818.11796-1-krisman@collabora.co.uk> Cc: daniel.vetter@intel.com, daniels@collabora.com, tomeu.vizoso@collabora.com Subject: [Intel-gfx] [PATCH v2 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;