Commit e135b943 authored by Heikki Krogerus's avatar Heikki Krogerus Committed by sanglipeng1
Browse files

usb: typec: ucsi: displayport: Fix potential deadlock

stable inclusion
from stable-v5.10.218
commit 7ed7748c94cb3d2e032cdefe7ba8e5e39dc02dcc
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAX0QZ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7ed7748c94cb3d2e032cdefe7ba8e5e39dc02dcc



--------------------------------

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: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Fixes: af8622f6 ("usb: typec: ucsi: Support for DisplayPort alt mode")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240507134316.161999-1-heikki.krogerus@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng1 <sanglipeng1@jd.com>
parent fbf2053d
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -249,8 +249,6 @@ static void ucsi_displayport_work(struct work_struct *work)
	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)
@@ -259,8 +257,6 @@ static void ucsi_displayport_work(struct work_struct *work)
	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)