]> asedeno.scripts.mit.edu Git - linux.git/commit
serial: sh-sci: Fix unlocked access to SCSCR register
authorTakatoshi Akiyama <takatoshi.akiyama.kj@ps.hitachi-solutions.com>
Thu, 2 Nov 2017 10:14:55 +0000 (11:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Nov 2017 11:08:53 +0000 (12:08 +0100)
commit1be2266392196de82d1cfcc8a68e770cf8f48c60
treedef07061b1b69d59ebe6c004e5a8e6ffadd35648
parent0ea46e6e58ab7447222bcaa10be0adcd9f92284d
serial: sh-sci: Fix unlocked access to SCSCR register

The SCSCR register access in sci_break_ctl() is not locked.

sci_start_tx() and sci_set_termios() changes the SCSCR register,
but does not lock sci_port.

Therefore, this patch adds lock during register access.

Also, remove the log output that leads to a double lock.

Some analysis of where locks are not taken is as follows.
It appears that the lock is not taken in:
  - sci_start_tx(), sci_stop_tx()  as this is installed as a callback.
    And all callers of the callback take the lock.
  - start_rx as callers take the lock.
  - stop_rx. this is both installed as a callback and called directly.
    In both cases the caller takes the lock.

Signed-off-by: Takatoshi Akiyama <takatoshi.akiyama.kj@ps.hitachi-solutions.com>
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c