==================================================================
BUG: KCSAN: data-race in n_tty_receive_buf_common / n_tty_write

write to 0xffffc9000d1e5020 of 8 bytes by task 23059 on cpu 0:
 process_echoes drivers/tty/n_tty.c:793 [inline]
 n_tty_write+0x198/0xb40 drivers/tty/n_tty.c:2283
 do_tty_write drivers/tty/tty_io.c:1024 [inline]
 file_tty_write+0x3f9/0x650 drivers/tty/tty_io.c:1095
 tty_write+0x24/0x30 drivers/tty/tty_io.c:1116
 call_write_iter include/linux/fs.h:2058 [inline]
 new_sync_write fs/read_write.c:504 [inline]
 vfs_write+0x71c/0x890 fs/read_write.c:591
 ksys_write+0xe8/0x1a0 fs/read_write.c:644
 __do_sys_write fs/read_write.c:656 [inline]
 __se_sys_write fs/read_write.c:653 [inline]
 __x64_sys_write+0x3e/0x50 fs/read_write.c:653
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0

read to 0xffffc9000d1e5020 of 8 bytes by task 1031 on cpu 1:
 flush_echoes drivers/tty/n_tty.c:807 [inline]
 __receive_buf drivers/tty/n_tty.c:1564 [inline]
 n_tty_receive_buf_common+0x499b/0x4c40 drivers/tty/n_tty.c:1658
 n_tty_receive_buf2+0x2e/0x40 drivers/tty/n_tty.c:1693
 tty_ldisc_receive_buf+0x5b/0xf0 drivers/tty/tty_buffer.c:452
 tty_port_default_receive_buf+0x54/0x80 drivers/tty/tty_port.c:39
 receive_buf drivers/tty/tty_buffer.c:472 [inline]
 flush_to_ldisc+0x1ca/0x2f0 drivers/tty/tty_buffer.c:522
 process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
 worker_thread+0x618/0xa70 kernel/workqueue.c:2436
 kthread+0x1a9/0x1e0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30

value changed: 0x0000000000000128 -> 0x000000000000012e

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 1031 Comm: kworker/u4:63 Not tainted 5.19.0-rc5-syzkaller-00233-gb1c428b6c368-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
Workqueue: events_unbound flush_to_ldisc
==================================================================