linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [08/12] usb: serial: sierra: disable irq's for portdata lock
@ 2018-06-23 22:32 Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-06-23 22:32 UTC (permalink / raw)
  To: linux-usb
  Cc: tglx, Johan Hovold, Greg Kroah-Hartman, John Ogness,
	Sebastian Andrzej Siewior

From: John Ogness <john.ogness@linutronix.de>

The portdata spinlock can be taken in interrupt context (via
sierra_outdat_callback()).
Disable interrupts when taking the portdata spinlock.

Cc: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/usb/serial/sierra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index d189f953c891..55956a638f5b 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -770,9 +770,9 @@ static void sierra_close(struct usb_serial_port *port)
 		kfree(urb->transfer_buffer);
 		usb_free_urb(urb);
 		usb_autopm_put_interface_async(serial->interface);
-		spin_lock(&portdata->lock);
+		spin_lock_irq(&portdata->lock);
 		portdata->outstanding_urbs--;
-		spin_unlock(&portdata->lock);
+		spin_unlock_irq(&portdata->lock);
 	}
 
 	sierra_stop_rx_urbs(port);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [08/12] usb: serial: sierra: disable irq's for portdata lock
@ 2018-06-26 13:41 Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2018-06-26 13:41 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-usb, tglx, Johan Hovold, Greg Kroah-Hartman, John Ogness

On Sun, Jun 24, 2018 at 12:32:11AM +0200, Sebastian Andrzej Siewior wrote:
> From: John Ogness <john.ogness@linutronix.de>
> 
> The portdata spinlock can be taken in interrupt context (via
> sierra_outdat_callback()).
> Disable interrupts when taking the portdata spinlock.

Good catch!

As this fixes a potential deadlock, I've reworded the commit message and
added a Fixes and stable-CC tag.

But as no one appears to have hit this since it was introduced over four
years ago, I think this can go into -next along with the rest of the
series.

All patches now applied. Nice work!

Thanks,
Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-26 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 13:41 [08/12] usb: serial: sierra: disable irq's for portdata lock Johan Hovold
  -- strict thread matches above, loose matches on Subject: below --
2018-06-23 22:32 Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).