mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 09:14:19 +08:00
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: Alexander Stein <alexander.stein@systec-electronic.com> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
d482443244
commit
367525c8c2
@ -322,13 +322,13 @@ static void slcan_write_wakeup(struct tty_struct *tty)
|
||||
if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev))
|
||||
return;
|
||||
|
||||
spin_lock(&sl->lock);
|
||||
spin_lock_bh(&sl->lock);
|
||||
if (sl->xleft <= 0) {
|
||||
/* Now serial buffer is almost free & we can start
|
||||
* transmission of another packet */
|
||||
sl->dev->stats.tx_packets++;
|
||||
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
|
||||
spin_unlock(&sl->lock);
|
||||
spin_unlock_bh(&sl->lock);
|
||||
netif_wake_queue(sl->dev);
|
||||
return;
|
||||
}
|
||||
@ -336,7 +336,7 @@ static void slcan_write_wakeup(struct tty_struct *tty)
|
||||
actual = tty->ops->write(tty, sl->xhead, sl->xleft);
|
||||
sl->xleft -= actual;
|
||||
sl->xhead += actual;
|
||||
spin_unlock(&sl->lock);
|
||||
spin_unlock_bh(&sl->lock);
|
||||
}
|
||||
|
||||
/* Send a can_frame to a TTY queue. */
|
||||
|
Loading…
Reference in New Issue
Block a user