usb: typec: ucsi: Hold con->lock for the entire duration of ucsi_register_port()
authorHans de Goede <hdegoede@redhat.com>
Sun, 9 Aug 2020 14:19:04 +0000 (16:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Aug 2020 10:08:51 +0000 (12:08 +0200)
commitbed97b30968ba354035a020989df0623e52b5536
tree3ab934c8f31b53d842f95b20679bc1865e7d93a3
parent25794e3079d2a98547b6bf5764ef0240aa89b798
usb: typec: ucsi: Hold con->lock for the entire duration of ucsi_register_port()

Commit 081da1325d35 ("usb: typec: ucsi: displayport: Fix a potential race
during registration") made the ucsi code hold con->lock in
ucsi_register_displayport(). But we really don't want any interactions
with the connector to run before the port-registration process is fully
complete.

This commit moves the taking of con->lock from ucsi_register_displayport()
into ucsi_register_port() to achieve this.

Cc: stable@vger.kernel.org
Fixes: 081da1325d35 ("usb: typec: ucsi: displayport: Fix a potential race during registration")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20200809141904.4317-5-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/displayport.c
drivers/usb/typec/ucsi/ucsi.c