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>
Thu, 3 Sep 2020 09:29:50 +0000 (11:29 +0200)
commitd597f82cc262cd67d49a3e8337ff8ff7ae07cc13
tree0c3dc633e28bc78e6567f79fd1b7e524c9389635
parent3c4cd68799f8d2e43c37b1b5707e1d281d193dae
usb: typec: ucsi: Hold con->lock for the entire duration of ucsi_register_port()

commit bed97b30968ba354035a020989df0623e52b5536 upstream.

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