linux-stable/drivers/tty
Roger Pau Monne ae935d2d2e hvc/xen: prevent concurrent accesses to the shared ring
[ Upstream commit 6214894f49 ]

The hvc machinery registers both a console and a tty device based on
the hv ops provided by the specific implementation.  Those two
interfaces however have different locks, and there's no single locks
that's shared between the tty and the console implementations, hence
the driver needs to protect itself against concurrent accesses.
Otherwise concurrent calls using the split interfaces are likely to
corrupt the ring indexes, leaving the console unusable.

Introduce a lock to xencons_info to serialize accesses to the shared
ring.  This is only required when using the shared memory console,
concurrent accesses to the hypercall based console implementation are
not an issue.

Note the conditional logic in domU_read_console() is slightly modified
so the notify_daemon() call can be done outside of the locked region:
it's an hypercall and there's no need for it to be done with the lock
held.

Fixes: b536b4b962 ('xen: use the hvc console infrastructure for Xen console')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20221130150919.13935-1-roger.pau@citrix.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-30 12:51:21 +02:00
..
hvc hvc/xen: prevent concurrent accesses to the shared ring 2023-03-30 12:51:21 +02:00
ipwireless
serdev
serial serial: 8250: ASPEED_VUART: select REGMAP instead of depending on it 2023-03-22 13:37:58 +01:00
vt vc_screen: modify vcs_size() handling in vcs_read() 2023-03-11 13:50:34 +01:00
amiserial.c tty: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
ehv_bytechan.c tty: evh_bytechan: Replace NO_IRQ by 0 2022-11-02 08:10:42 +01:00
goldfish.c tty: goldfish: Fix free_irq() on remove 2022-06-10 13:31:31 +02:00
Kconfig tty: Allow TIOCSTI to be disabled 2022-11-03 01:58:03 +01:00
Makefile
mips_ejtag_fdc.c serial: Convert SERIAL_XMIT_SIZE to UART_XMIT_SIZE 2022-06-27 14:41:31 +02:00
moxa.c tty: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mxser.c tty: mxser: remove redundant assignment to hwid 2022-09-01 17:59:36 +02:00
n_gsm.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
n_hdlc.c tty: n_hdlc: remove HDLC_MAGIC 2022-09-22 16:12:34 +02:00
n_null.c
n_tty.c n_tty: Rename tail to old_tail in n_tty_read() 2022-11-22 17:51:34 +01:00
nozomi.c
pty.c tty: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
rpmsg_tty.c
synclink_gt.c tty: synclink_gt: unwind actions in error path of net device open 2022-11-22 17:52:57 +01:00
sysrq.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
tty.h tty: Move sysctl setup into "core" tty logic 2022-11-03 01:58:03 +01:00
tty_audit.c
tty_baudrate.c tty: Fix comment style in tty_termios_input_baud_rate() 2022-08-30 14:22:34 +02:00
tty_buffer.c tty: Convert tty_buffer flags to bool 2022-11-09 13:02:16 +01:00
tty_io.c tty: fix out-of-bounds access in tty_driver_lookup_tty() 2023-03-11 13:50:40 +01:00
tty_ioctl.c termios: start unifying non-UAPI parts of asm/termios.h 2022-09-09 10:44:34 +02:00
tty_jobctrl.c signal: Replace __group_send_sig_info with send_signal_locked 2022-05-11 14:33:17 -05:00
tty_ldisc.c tty: Move sysctl setup into "core" tty logic 2022-11-03 01:58:03 +01:00
tty_ldsem.c
tty_mutex.c tty: remove TTY_MAGIC 2022-09-22 16:12:34 +02:00
tty_port.c tty: Implement lookahead to process XON/XOFF timely 2022-06-10 13:51:31 +02:00
ttynull.c
vcc.c termios: start unifying non-UAPI parts of asm/termios.h 2022-09-09 10:44:34 +02:00