From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2640C1D545; Thu, 23 May 2024 13:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716470801; cv=none; b=KYSac9uNMz4kz+JUplB2zB+tPDMIoddQKlZT8M/EROziaqpnHvqBo1jb4QbJ+XmtMHG9KJJ3OOJxaVvTQaJ7osk4Kh7FpSV4p0dt1iI183nffXm9X/D3x4H3dHXxihiVJ+Hm3aHiCovc8MBm5cP5wWbOZ8DLzKREgU/bYr0vHfA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716470801; c=relaxed/simple; bh=m7GFsE/xef5dGA9OIX9kD3UBo8uPMOujDDszJN0nJ6I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c65KmGcxQDCwf2xwPYt0ietVK9xJZhRk3R0LP2NNInYitHrIGC1cAZA7WCzp4oG/Mlz5G+RS+zrmjLW3pXAIGWoO52sEz0Yi9e1EXvOmJN+MGU8sDoxUL/C/Z69RxKnSycYzro198gOPDaBGbDgC74lG2Z322qwsLeLeBKJDxL4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SlBlMNUL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SlBlMNUL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4778C2BD10; Thu, 23 May 2024 13:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716470801; bh=m7GFsE/xef5dGA9OIX9kD3UBo8uPMOujDDszJN0nJ6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SlBlMNULYALA6OafFzQ82msfsS6hQePPlw9SlFsO3uhw0fG6hfIT+DxJrGRMDOjvz A9VF2rtvQE+MarJdE2UI6+2E64OKre0URRSGk3BIXngBtLLcz2Rt0HxCBrVDkiQ6Zg FTP0MLSkCQzgIKPEUd/qztpLZv3LRqZQq8mbDSfY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mathias Nyman , Heikki Krogerus Subject: [PATCH 6.6 093/102] usb: typec: ucsi: displayport: Fix potential deadlock Date: Thu, 23 May 2024 15:13:58 +0200 Message-ID: <20240523130345.979849755@linuxfoundation.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240523130342.462912131@linuxfoundation.org> References: <20240523130342.462912131@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heikki Krogerus commit b791a67f68121d69108640d4a3e591d210ffe850 upstream. The function ucsi_displayport_work() does not access the connector, so it also must not acquire the connector lock. This fixes a potential deadlock scenario: ucsi_displayport_work() -> lock(&con->lock) typec_altmode_vdm() dp_altmode_vdm() dp_altmode_work() typec_altmode_enter() ucsi_displayport_enter() -> lock(&con->lock) Reported-by: Mathias Nyman Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode") Cc: stable@vger.kernel.org Signed-off-by: Heikki Krogerus Link: https://lore.kernel.org/r/20240507134316.161999-1-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/displayport.c | 4 ---- 1 file changed, 4 deletions(-) --- a/drivers/usb/typec/ucsi/displayport.c +++ b/drivers/usb/typec/ucsi/displayport.c @@ -275,8 +275,6 @@ static void ucsi_displayport_work(struct struct ucsi_dp *dp = container_of(work, struct ucsi_dp, work); int ret; - mutex_lock(&dp->con->lock); - ret = typec_altmode_vdm(dp->alt, dp->header, dp->vdo_data, dp->vdo_size); if (ret) @@ -285,8 +283,6 @@ static void ucsi_displayport_work(struct dp->vdo_data = NULL; dp->vdo_size = 0; dp->header = 0; - - mutex_unlock(&dp->con->lock); } void ucsi_displayport_remove_partner(struct typec_altmode *alt)