Commit 7fa57a0cd98bdd163eeb5f15cbe234c3a0cf68a1

Authored by Jiri Slaby
Committed by Linus Torvalds
1 parent 1ddd439ef9

Char: cyclades, fix potential NULL dereference

ztxdone is jumped to even if tty is NULL and tty_wakeup placed after
this label doesn't expect NULLed parameter, so this will cause an oops
in some situations (why they scheduled a wakeup there before remove
bottom half processing patch?).

wakeup only in the case when we have non-null tty struct.

Spotted by Adrian Bunk.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/char/cyclades.c
... ... @@ -1602,8 +1602,8 @@
1602 1602 info->icount.tx++;
1603 1603 }
1604 1604 #endif
1605   -ztxdone:
1606 1605 tty_wakeup(tty);
  1606 +ztxdone:
1607 1607 /* Update tx_put */
1608 1608 cy_writel(&buf_ctrl->tx_put, tx_put);
1609 1609 }