From patchwork Fri Mar 4 23:43:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 8508251 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 124EB9F314 for ; Fri, 4 Mar 2016 23:46:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 364FF2026C for ; Fri, 4 Mar 2016 23:46:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4A622201EF for ; Fri, 4 Mar 2016 23:46:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12C8A6E86D; Fri, 4 Mar 2016 23:46:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x235.google.com (mail-pf0-x235.google.com [IPv6:2607:f8b0:400e:c00::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1DF066E86D for ; Fri, 4 Mar 2016 23:44:26 +0000 (UTC) Received: by mail-pf0-x235.google.com with SMTP id x188so19508660pfb.2 for ; Fri, 04 Mar 2016 15:44:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=g+80mRuXscSLzc5v/pIEXQ3V4TFUutbEtzFGNTVG+vI=; b=Vv6rzcyIf2lMdPaK+myQ9DvgUfHy2tjv+IU+PDL6hYWdjNLXfdCRKo5t8hrk9D218e pCGs4G3dghS6a97hT22138PUz7fvwuFddh+fdX0kf5vpg9WL/9bD2WMVxOiuyLjHVb8M h82i4KWSY6LIQ/awe/1Y1lxqAt1VEVl28hFEw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=g+80mRuXscSLzc5v/pIEXQ3V4TFUutbEtzFGNTVG+vI=; b=nGBI9jizuez+yMr3fTcRk+NaznngvsGElw0mbnp2ULJitRpTuqYZHZpRNRn11jG73h MvOXrrx2rgqfcu6eVCXIJS16meqEX3urBY7Q4q9JizGqgMtWGs5SrpGIL/yRNx9fKG03 9f6Bb4og0A/ISZYG/gI/ybATQdIuDA83zUK4QDiqiCnUAo8Cp5KE9uS16Qha9LcekQkm +ps2weCovYhYTLkjknC+LUr6LuE/J8oAzFytA0+W1kB7NAcZzIsZr1bk/0kQvTng7PDN uPfNrT6qNgYmckr+oGyXUQqBzBv4eCJ2K9yLpSYZvPBb6mkZt+L2vBzOQK4M5J9CbXqn 5FPg== X-Gm-Message-State: AD7BkJKonQwq3/PO9BKgEGY0LdjM3lUwpCyJs0JBMvPz4mVs//Rd102CvebnFAkaHdKd5w== X-Received: by 10.98.75.212 with SMTP id d81mr16089306pfj.148.1457135065359; Fri, 04 Mar 2016 15:44:25 -0800 (PST) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by smtp.gmail.com with ESMTPSA id ud10sm7917227pab.27.2016.03.04.15.44.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Mar 2016 15:44:24 -0800 (PST) From: Douglas Anderson To: David Airlie Subject: [PATCH] drm: Check for connector->state NULL in drm_atomic_add_affected_connectors Date: Fri, 4 Mar 2016 15:43:53 -0800 Message-Id: <1457135033-11791-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Douglas Anderson X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On a system I'm doing development on I found a crash. The crawl looked like: PC is at drm_atomic_add_affected_connectors+0x98/0xe8 ... drm_atomic_add_affected_connectors from __drm_atomic_helper_set_config+0x218/0x344 __drm_atomic_helper_set_config from restore_fbdev_mode+0x108/0x250 restore_fbdev_mode from drm_fb_helper_restore_fbdev_mode_unlocked+0x3c/0x80 drm_fb_helper_restore_fbdev_mode_unlocked from rockchip_drm_lastclose+0x1c/0x20 rockchip_drm_lastclose from drm_lastclose+0x4c/0x104 drm_lastclose from drm_release+0x424/0x47c drm_release from __fput+0xf8/0x1d4 __fput from ____fput+0x18/0x1c ____fput from task_work_run+0xa8/0xbc task_work_run from do_exit+0x448/0x91c do_exit from do_group_exit+0x5c/0xcc do_group_exit from get_signal+0x4dc/0x57c get_signal from do_signal+0x9c/0x3b4 do_signal from do_work_pending+0x60/0xb8 do_work_pending from slow_work_pending+0xc/0x20 I found that I could fix the crash by checking connector->state against NULL. This isn't code I'm familiar with and I didn't dig too deep, so I'd appreciate any opinions about whether this is a sane thing to do. Note that I don't actually have graphics up on my system at the moment, so perhaps this is all just a symptom of the strange state I'm in. Signed-off-by: Douglas Anderson --- drivers/gpu/drm/drm_atomic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 8fb469c4e4b8..3377d7ddc6d1 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1147,7 +1147,7 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state, * current configuration. */ drm_for_each_connector(connector, state->dev) { - if (connector->state->crtc != crtc) + if (!connector->state || connector->state->crtc != crtc) continue; conn_state = drm_atomic_get_connector_state(state, connector);