tty: n_gsm: fix reset fifo race condition
authorDaniel Starke <daniel.starke@siemens.com>
Thu, 14 Apr 2022 09:42:22 +0000 (02:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Apr 2022 06:36:05 +0000 (08:36 +0200)
commit73029a4d7161f8b6c0934553145ef574d2d0c645
tree5c170b7c583b0768b6d171c611cae675efc1eb94
parent1adf6fee58ca25fb6720b8d34c919dcf5425cc9c
tty: n_gsm: fix reset fifo race condition

gsmtty_write() and gsm_dlci_data_output() properly guard the fifo access.
However, gsm_dlci_close() and gsmtty_flush_buffer() modifies the fifo but
do not guard this.
Add a guard here to prevent race conditions on parallel writes to the fifo.

Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20220414094225.4527-17-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_gsm.c