Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a759b20f authored by Dmitry Vyukov's avatar Dmitry Vyukov Committed by lingutla
Browse files

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).

Change-Id: I9dcd01dcc82a6f9d4fe17ee54bb70acc7e731765
Signed-off-by: default avatarDmitry Vyukov <dvyukov@google.com>
Reviewed-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 7098296a362a96051fa120abf48f0095818b99cd
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarlingutla <clingutla@codeaurora.org>
parent ece627a6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment