Skip to content

Commit

Permalink
staging: sb105x: fix potential NULL pointer dereference in mp_chars_i…
Browse files Browse the repository at this point in the history
…n_buffer()

The dereference to 'state' should be moved below the NULL test.

Cc: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Wei Yongjun authored and Greg Kroah-Hartman committed Nov 30, 2012
1 parent 218cbbd commit b0ab023
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/staging/sb105x/sb_pci_mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,14 @@ static int mp_chars_in_buffer(struct tty_struct *tty)
static void mp_flush_buffer(struct tty_struct *tty)
{
struct sb_uart_state *state = tty->driver_data;
struct sb_uart_port *port = state->port;
struct sb_uart_port *port;
unsigned long flags;

if (!state || !state->info) {
return;
}

port = state->port;
spin_lock_irqsave(&port->lock, flags);
uart_circ_clear(&state->info->xmit);
spin_unlock_irqrestore(&port->lock, flags);
Expand Down

0 comments on commit b0ab023

Please sign in to comment.