--- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c @@ -210,6 +210,7 @@ static int handle_tx(struct ser_device * struct tty_struct *tty; struct sk_buff *skb; int tty_wr, len, room; + unsigned long ts; tty = ser->tty; ser->tx_started = true; @@ -218,8 +219,11 @@ static int handle_tx(struct ser_device * if (test_and_set_bit(CAIF_SENDING, &ser->state)) return 0; + ts = jiffies + 2; /* skb_peek is safe because handle_tx is called after skb_queue_tail */ while ((skb = skb_peek(&ser->head)) != NULL) { + if (jiffies > ts) + break; /* Make sure you don't write too much */ len = skb->len;