Skip to content

Commit 76cf1f3

Browse files
Andrei Kuchynskigregkh
authored andcommitted
usb: typec: displayport: Fix potential deadlock
commit 099cf1fbb8afc3771f408109f62bdec66f85160e upstream. The deadlock can occur due to a recursive lock acquisition of `cros_typec_altmode_data::mutex`. The call chain is as follows: 1. cros_typec_altmode_work() acquires the mutex 2. typec_altmode_vdm() -> dp_altmode_vdm() -> 3. typec_altmode_exit() -> cros_typec_altmode_exit() 4. cros_typec_altmode_exit() attempts to acquire the mutex again To prevent this, defer the `typec_altmode_exit()` call by scheduling it rather than calling it directly from within the mutex-protected context. Cc: stable <[email protected]> Fixes: b4b38ffb38c9 ("usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode") Signed-off-by: Andrei Kuchynski <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent fdc38ab commit 76cf1f3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/usb/typec/altmodes/displayport.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,7 @@ static int dp_altmode_vdm(struct typec_altmode *alt,
321321
case CMDT_RSP_NAK:
322322
switch (cmd) {
323323
case DP_CMD_STATUS_UPDATE:
324-
if (typec_altmode_exit(alt))
325-
dev_err(&dp->alt->dev, "Exit Mode Failed!\n");
324+
dp->state = DP_STATE_EXIT;
326325
break;
327326
case DP_CMD_CONFIGURE:
328327
dp->data.conf = 0;

0 commit comments

Comments
 (0)