mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
tty: fix data race in flush_to_ldisc
flush_to_ldisc reads port->itty and checks that it is not NULL, concurrently release_tty sets port->itty to NULL. It is possible that flush_to_ldisc loads port->itty once, ensures that it is not NULL, but then reloads it again and uses. The second load can already return NULL, which will cause a crash. Use READ_ONCE to read port->itty. The data race was found with KernelThreadSanitizer (KTSAN). Signed-off-by: Dmitry Vyukov <[email protected]> Reviewed-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
e81107d4c6
commit
7098296a36
1 changed files with 1 additions and 1 deletions
|
|
@ -467,7 +467,7 @@ static void flush_to_ldisc(struct work_struct *work)
|
|||
struct tty_struct *tty;
|
||||
struct tty_ldisc *disc;
|
||||
|
||||
tty = port->itty;
|
||||
tty = READ_ONCE(port->itty);
|
||||
if (tty == NULL)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue