Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2833547pxb; Mon, 1 Nov 2021 02:48:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCJIPI+u7R4Qk85/hZWyZwk0xqA2bxxbKTRTeQ4p/kcANd6rdfNEL6Y6/GpF04ffvnZO69 X-Received: by 2002:a17:906:c283:: with SMTP id r3mr14408459ejz.138.1635760129543; Mon, 01 Nov 2021 02:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760129; cv=none; d=google.com; s=arc-20160816; b=LH9rdgXto05YC6Q2vHK6jrwon14O+JFvPYXWyLUizTzl931bjetSdMIYnvkqrBIZBE MLN3L6MFpUPF6469YweGnFUj+ntwNJZz2JPF9pNnQn9H3yQf9WJhKr5gGbHgJ5CeEDl7 3UUCUQBx80gyIxBLnGsPc4dRac2vhNjT4lwRLgSvrZCxBi1d65PzoEeby21jUwE9OQsI Rey7UUQlY0dAKOx1vxyriZFJLtBEwVprfgOhhauuvOZL1qaksGqvG61eXsabZQ7jOjLb SDmxyjPqH8kJ3n6R2SRQFDzqwNdTiSocM6O9cZnyuG5SH6v7cPlegHu04tbPlGLgejNs GXQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QQVPhLdxnTmQzK+0d0bgI+ITuBqWa4+R+/hZ/KLrTiw=; b=tJK756RBAK8F86y2lCKY9MoVqfgBZmYCRIcdmptnSSHG8zSDZjRncpfgBQkWiBMdL5 eol1ZAumqv6f+0rt6Bcxe2WZBL97Hs9c1n5TafMSAk6/2xoZL5Phupqyo9oKRJqGPAPP UDhO3zqlV0bPHqRfFg/APMc2vUnUOof9CtEKkBhgHHM7wDEtnXu9xubfhc/Q5U9vRJvA RuVTo67Rc5Nb9btwBLSYcdVPW6PnqOAmkBvAbxvXa/t/3OwLpOMaJVwgp8ZGVbnYKCua C4ymLwJSTjzPYm514NIVIu4jmuOtlvbmcZ78OwvHoPULsVg7jzgFv3/QHUW5T+PWtriH zCqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=at7aOPxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si17574885ejv.36.2021.11.01.02.48.25; Mon, 01 Nov 2021 02:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=at7aOPxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234368AbhKAJsQ (ORCPT + 99 others); Mon, 1 Nov 2021 05:48:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:47952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234072AbhKAJoD (ORCPT ); Mon, 1 Nov 2021 05:44:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 519DC613A7; Mon, 1 Nov 2021 09:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758963; bh=xVN+tuD72jEaxUbrrSNkVumd7VGK1bDnzJPn6ufC6Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=at7aOPxtj90FCH6v3XlgfucvaIzYjg11A8P3c3SwFqJb+odmTyInQoscjqKF1L+JX 5Ym4HOV0NBywcJvxBc0eQz2la/wclN5e+2c3MpizHBf+/ktnIbBx0nMBueaezMadOJ 0jNsvq2bH7+xfDuolJi92i6Yrys7+IVzMmJ6Ia48= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Kazlauskas , Aric Cyr , Alex Deucher Subject: [PATCH 5.14 056/125] drm/amd/display: Fix deadlock when falling back to v2 from v3 Date: Mon, 1 Nov 2021 10:17:09 +0100 Message-Id: <20211101082543.773829070@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082533.618411490@linuxfoundation.org> References: <20211101082533.618411490@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Kazlauskas commit ad76744b041d8c87ef1c9adbb04fb7eaa20a179e upstream. [Why] A deadlock in the kernel occurs when we fallback from the V3 to V2 add_topology_to_display or remove_topology_to_display because they both try to acquire the dtm_mutex but recursive locking isn't supported on mutex_lock(). [How] Make the mutex_lock/unlock more fine grained and move them up such that they're only required for the psp invocation itself. Fixes: bf62221e9d0e ("drm/amd/display: Add DCN3.1 HDCP support") Signed-off-by: Nicholas Kazlauskas Reviewed-by: Aric Cyr Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c @@ -105,6 +105,7 @@ static enum mod_hdcp_status mod_hdcp_rem dtm_cmd->dtm_status = TA_DTM_STATUS__GENERIC_FAILURE; psp_dtm_invoke(psp, dtm_cmd->cmd_id); + mutex_unlock(&psp->dtm_context.mutex); if (dtm_cmd->dtm_status != TA_DTM_STATUS__SUCCESS) { status = mod_hdcp_remove_display_from_topology_v2(hdcp, index); @@ -115,8 +116,6 @@ static enum mod_hdcp_status mod_hdcp_rem HDCP_TOP_REMOVE_DISPLAY_TRACE(hdcp, display->index); } - mutex_unlock(&psp->dtm_context.mutex); - return status; } @@ -218,6 +217,7 @@ static enum mod_hdcp_status mod_hdcp_add dtm_cmd->dtm_in_message.topology_update_v3.link_hdcp_cap = link->hdcp_supported_informational; psp_dtm_invoke(psp, dtm_cmd->cmd_id); + mutex_unlock(&psp->dtm_context.mutex); if (dtm_cmd->dtm_status != TA_DTM_STATUS__SUCCESS) { status = mod_hdcp_add_display_to_topology_v2(hdcp, display); @@ -227,8 +227,6 @@ static enum mod_hdcp_status mod_hdcp_add HDCP_TOP_ADD_DISPLAY_TRACE(hdcp, display->index); } - mutex_unlock(&psp->dtm_context.mutex); - return status; }