linux-stable/drivers/tty
Christophe Leroy 36ef11d311 serial: cpm_uart: Avoid suspicious locking
CHECK   drivers/tty/serial/cpm_uart/cpm_uart_core.c
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1271:39: warning: context imbalance in 'cpm_uart_console_write' - unexpected unlock

Allthough 'nolock' is not expected to change, sparse find the following
form suspicious:

	if (unlikely(nolock)) {
		local_irq_save(flags);
	} else {
		spin_lock_irqsave(&pinfo->port.lock, flags);
	}

	cpm_uart_early_write(pinfo, s, count, true);

	if (unlikely(nolock)) {
		local_irq_restore(flags);
	} else {
		spin_unlock_irqrestore(&pinfo->port.lock, flags);
	}

Rewrite it a more obvious form:

	if (unlikely(oops_in_progress)) {
		local_irq_save(flags);
		cpm_uart_early_write(pinfo, s, count, true);
		local_irq_restore(flags);
	} else {
		spin_lock_irqsave(&pinfo->port.lock, flags);
		cpm_uart_early_write(pinfo, s, count, true);
		spin_unlock_irqrestore(&pinfo->port.lock, flags);
	}

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/f7da5cdc9287960185829cfef681a7d8614efa1f.1691068700.git.christophe.leroy@csgroup.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-04 15:08:29 +02:00
..
hvc tty: hvsi: remove an extra variable from hvsi_write() 2023-07-31 17:16:05 +02:00
ipwireless
serdev serdev: Add method to assert break signal over tty UART port 2023-04-23 21:51:25 -07:00
serial serial: cpm_uart: Avoid suspicious locking 2023-08-04 15:08:29 +02:00
vt tty: vt: Remove some repetitive initialization 2023-08-03 09:51:51 +02:00
amiserial.c tty: Convert hw_stopped in tty_struct to bool 2023-03-17 15:01:09 +01:00
ehv_bytechan.c tty: evh_bytechan: Replace NO_IRQ by 0 2022-11-02 08:10:42 +01:00
goldfish.c
Kconfig tty: synclink_gt: mark as BROKEN 2023-07-31 17:16:21 +02:00
Makefile
mips_ejtag_fdc.c
moxa.c tty: moxa: Rename dtr/rts parameters/variables to active 2023-01-19 16:04:35 +01:00
mxser.c tty: Convert hw_stopped in tty_struct to bool 2023-03-17 15:01:09 +01:00
n_gsm.c tty: n_gsm: require CAP_NET_ADMIN to attach N_GSM0710 ldisc 2023-08-04 15:06:54 +02: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: make many tty parameters const 2023-07-25 19:19:39 +02:00
nozomi.c
pty.c tty: make tty_class a static const structure 2023-04-03 21:43:07 +02:00
rpmsg_tty.c
synclink_gt.c tty: synclink_gt: Fix potential deadlock on &info->lock 2023-08-04 15:05:56 +02:00
sysrq.c tty: sysrq: use switch in sysrq_key_table_key2index() 2023-07-25 19:21:03 +02:00
tty.h tty_audit: make tty pointers in exposed functions const 2023-06-21 17:57:29 +02:00
tty_audit.c tty_audit: make data of tty_audit_log() const 2023-06-21 17:57:29 +02:00
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 Merge 6.5-rc4 into tty-next 2023-07-31 09:39:56 +02:00
tty_ioctl.c tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH 2023-03-29 10:55:53 +02:00
tty_jobctrl.c
tty_ldisc.c tty: tty_ldisc: Remove the ret variable 2023-03-09 17:11:18 +01:00
tty_ldsem.c
tty_mutex.c tty: remove TTY_MAGIC 2022-09-22 16:12:34 +02:00
tty_port.c tty: Convert ->dtr_rts() to take bool argument 2023-01-19 16:04:35 +01:00
ttynull.c
vcc.c termios: start unifying non-UAPI parts of asm/termios.h 2022-09-09 10:44:34 +02:00