Skip to content

Commit

Permalink
tty: serial: imx: move del_timer_sync() to avoid potential deadlock
Browse files Browse the repository at this point in the history
del_timer_sync() acquires its own lock and doesn't have to be nested
within the spinlock of sport->port.lock in imx_set_termios(),  which
will cause potential deadlock.  Fix this by moving it outside.

Cc: Fabio Estevam <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Eric Miao <[email protected]>
Signed-off-by: Shawn Guo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Eric Miao authored and gregkh committed Jan 5, 2012
1 parent 01f56ab commit 995234d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,8 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
ucr2 |= UCR2_PROE;
}

del_timer_sync(&sport->timer);

/*
* Ask the core to calculate the divisor for us.
*/
Expand Down Expand Up @@ -962,8 +964,6 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
sport->port.ignore_status_mask |= URXD_OVRRUN;
}

del_timer_sync(&sport->timer);

/*
* Update the per-port timeout.
*/
Expand Down

0 comments on commit 995234d

Please sign in to comment.