Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: typec: ucsi: displayport: Fix potential deadlock

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 <mathias.nyman@linux.intel.com>
Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
Cc: stable@vger.kernel.org
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240507134316.161999-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Heikki Krogerus and committed by
Greg Kroah-Hartman
b791a67f 718b36a7

-4
-4
drivers/usb/typec/ucsi/displayport.c
··· 275 275 struct ucsi_dp *dp = container_of(work, struct ucsi_dp, work); 276 276 int ret; 277 277 278 - mutex_lock(&dp->con->lock); 279 - 280 278 ret = typec_altmode_vdm(dp->alt, dp->header, 281 279 dp->vdo_data, dp->vdo_size); 282 280 if (ret) ··· 283 285 dp->vdo_data = NULL; 284 286 dp->vdo_size = 0; 285 287 dp->header = 0; 286 - 287 - mutex_unlock(&dp->con->lock); 288 288 } 289 289 290 290 void ucsi_displayport_remove_partner(struct typec_altmode *alt)