Commit 367525c8 authored by Alexander Stein's avatar Alexander Stein Committed by Marc Kleine-Budde

can: slcan: Fix spinlock variant

slc_xmit is called within softirq context and locks sl->lock, but
slcan_write_wakeup is not softirq context, so we need to use
spin_[un]lock_bh!
Detected using kernel lock debugging mechanism.
Signed-off-by: default avatarAlexander Stein <alexander.stein@systec-electronic.com>
Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent d4824432
...@@ -322,13 +322,13 @@ static void slcan_write_wakeup(struct tty_struct *tty) ...@@ -322,13 +322,13 @@ static void slcan_write_wakeup(struct tty_struct *tty)
if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev))
return; return;
spin_lock(&sl->lock); spin_lock_bh(&sl->lock);
if (sl->xleft <= 0) { if (sl->xleft <= 0) {
/* Now serial buffer is almost free & we can start /* Now serial buffer is almost free & we can start
* transmission of another packet */ * transmission of another packet */
sl->dev->stats.tx_packets++; sl->dev->stats.tx_packets++;
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
spin_unlock(&sl->lock); spin_unlock_bh(&sl->lock);
netif_wake_queue(sl->dev); netif_wake_queue(sl->dev);
return; return;
} }
...@@ -336,7 +336,7 @@ static void slcan_write_wakeup(struct tty_struct *tty) ...@@ -336,7 +336,7 @@ static void slcan_write_wakeup(struct tty_struct *tty)
actual = tty->ops->write(tty, sl->xhead, sl->xleft); actual = tty->ops->write(tty, sl->xhead, sl->xleft);
sl->xleft -= actual; sl->xleft -= actual;
sl->xhead += actual; sl->xhead += actual;
spin_unlock(&sl->lock); spin_unlock_bh(&sl->lock);
} }
/* Send a can_frame to a TTY queue. */ /* Send a can_frame to a TTY queue. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment