diff options
author | norly <ny-git@enpas.org> | 2019-02-19 00:23:12 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2019-02-19 00:23:12 +0100 |
commit | 36e4fcf1d8f65e51e2baf5c4de091b0862bb02fb (patch) | |
tree | bbef76abcf2711b8cb5e5aa5526fb4304b83c123 | |
parent | 98a440e3f0152d1f4b4a28f8960f7443579a78bd (diff) |
Ignore tty RX after HW failure, locking fix
-rw-r--r-- | module/elmcan.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/module/elmcan.c b/module/elmcan.c index e0a2fde..1be5da8 100644 --- a/module/elmcan.c +++ b/module/elmcan.c @@ -945,6 +945,14 @@ static void elmcan_ldisc_rx(struct tty_struct *tty, if (!elm) return; + spin_lock_bh(&elm->lock); + if (elm->hw_failure) { + spin_unlock_bh(&elm->lock); + + put_elm(elm); + return; + } + /* Read the characters out of the buffer */ while (count-- && elm->rxfill < sizeof(elm->rxbuf)) { if (fp && *fp++) { @@ -966,7 +974,6 @@ static void elmcan_ldisc_rx(struct tty_struct *tty, if (count >= 0) { netdev_err(elm->dev, "Receive buffer overflowed. Bad chip or wiring?"); - spin_lock_bh(&elm->lock); elm327_hw_failure(elm); spin_unlock_bh(&elm->lock); @@ -974,7 +981,6 @@ static void elmcan_ldisc_rx(struct tty_struct *tty, return; } - spin_lock_bh(&elm->lock); elm327_parse_rxbuf(elm); spin_unlock_bh(&elm->lock); |