From: Johan Hovold Date: Mon, 2 Mar 2015 08:55:26 +0000 (+0100) Subject: greybus: connection: fix locking in gb_hd_connection_find X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1690 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8f5eadb7ea6a0c1cbedbfd33d9d0b94dac400d90;p=karo-tx-linux.git greybus: connection: fix locking in gb_hd_connection_find Fix unconditional re-enabling of interrupts in gb_hd_connection_find, which can be called with local interrupts disabled from the USB completion handler. Signed-off-by: Johan Hovold Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 5f60e83aa37c..3ec984c8d7e5 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -18,14 +18,15 @@ struct gb_connection *gb_hd_connection_find(struct greybus_host_device *hd, u16 cport_id) { struct gb_connection *connection = NULL; + unsigned long flags; - spin_lock_irq(&gb_connections_lock); + spin_lock_irqsave(&gb_connections_lock, flags); list_for_each_entry(connection, &hd->connections, hd_links) if (connection->hd_cport_id == cport_id) goto found; connection = NULL; found: - spin_unlock_irq(&gb_connections_lock); + spin_unlock_irqrestore(&gb_connections_lock, flags); return connection; }