Skip to content

Commit

Permalink
usb: typec: ucsi: displayport: Fix potential deadlock
Browse files Browse the repository at this point in the history
commit b791a67 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 <[email protected]>
Fixes: af8622f ("usb: typec: ucsi: Support for DisplayPort alt mode")
Cc: [email protected]
Signed-off-by: Heikki Krogerus <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Heikki Krogerus authored and gregkh committed May 25, 2024
1 parent ddbcd7d commit 1768f29
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/usb/typec/ucsi/displayport.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,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)
Expand All @@ -285,8 +283,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)
Expand Down

0 comments on commit 1768f29

Please sign in to comment.