From patchwork Fri Apr 3 07:45:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommi Rantala X-Patchwork-Id: 6153981 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 3A5FA9F389 for ; Fri, 3 Apr 2015 07:47:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7008A2038A for ; Fri, 3 Apr 2015 07:46:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 481002028D for ; Fri, 3 Apr 2015 07:46:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A66BE6EB37; Fri, 3 Apr 2015 00:46:56 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AF7A6EB37 for ; Fri, 3 Apr 2015 00:46:55 -0700 (PDT) Received: by lahf3 with SMTP id f3so74797735lah.2 for ; Fri, 03 Apr 2015 00:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=hzIe9+dlOmn/T6FgQvgQoaEpK4SwWd2CvbXtu7ezD6M=; b=qNSf5Ey3F8UtIg14SICao1/V/ojhrCFurJniLpK5mUNCPdqfWd3kNvhCM0ZQMN5YVg oeheCkroNK9z46r38HtdQxQy2dFO41BGP8D6lyjQyoSRFCDo0bWZHS8G3nM81tP/00/6 rLrkLHroyV5UE+kv1kigxNAgJKz1IXLhTUMW5n9ZlrE8EKnguTU3V5R1MlAdUnPSh5+O S+vYArQlwu9HVpj/f+TsJGi2XzJ11t0c5F8HEx454P9GBSol+j4U07betqqRaeImEXcr jw+PLdOOPrTQiQsd8a/sDqMD3i5TtOvYcJu6WH8hYqHhG5FrCDnYLyLFlpGHkI/gkqIQ MACw== X-Received: by 10.152.203.134 with SMTP id kq6mr1098986lac.110.1428047214293; Fri, 03 Apr 2015 00:46:54 -0700 (PDT) Received: from localhost.localdomain.localdomain (81-175-192-243.bb.dnainternet.fi. [81.175.192.243]) by mx.google.com with ESMTPSA id x4sm1435807lba.22.2015.04.03.00.46.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 00:46:53 -0700 (PDT) From: Tommi Rantala To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: fix drm_mode_getconnector() locking imbalance regression Date: Fri, 3 Apr 2015 10:45:29 +0300 Message-Id: <1428047129-26835-1-git-send-email-tt.rantala@gmail.com> X-Mailer: git-send-email 2.1.0 Cc: Daniel Vetter 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 Regression in commit 2caa80e72b57c6216aec6f6a11fcfb4fec46daa0 Author: Daniel Vetter Date: Sun Feb 22 11:38:36 2015 +0100 drm: Fix deadlock due to getconnector locking changes If the drm_connector_find() call returns NULL, we should no longer call drm_modeset_unlock() to avoid locking imbalance. Signed-off-by: Tommi Rantala Cc: Daniel Vetter Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 679b10e..b6f076b 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2121,7 +2121,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, connector = drm_connector_find(dev, out_resp->connector_id); if (!connector) { ret = -ENOENT; - goto out; + goto out_unlock; } for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) @@ -2201,6 +2201,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, out: drm_modeset_unlock(&dev->mode_config.connection_mutex); + +out_unlock: mutex_unlock(&dev->mode_config.mutex); return ret;