Char: cyclades, fix potential NULL dereference
authorJiri Slaby <jirislaby@gmail.com>
Tue, 23 Oct 2007 03:45:13 +0000 (20:45 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 23 Oct 2007 15:32:06 +0000 (08:32 -0700)
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>
drivers/char/cyclades.c

index d1bd0f08a331bcf0d98f3a8526eec05173666552..e4f579c3e2455640a3d1dc27c742e20d26ea2c01 100644 (file)
@@ -1602,8 +1602,8 @@ static void cyz_handle_tx(struct cyclades_port *info,
                        info->icount.tx++;
                }
 #endif
-ztxdone:
                tty_wakeup(tty);
+ztxdone:
                /* Update tx_put */
                cy_writel(&buf_ctrl->tx_put, tx_put);
        }