1
0
Fork 0
alistair23-linux/drivers/tty/hvc
Tyrel Datwyler bf94a8754f tty: hvcs: Don't NULL tty->driver_data until hvcs_cleanup()
[ Upstream commit 63ffcbdad7 ]

The code currently NULLs tty->driver_data in hvcs_close() with the
intent of informing the next call to hvcs_open() that device needs to be
reconfigured. However, when hvcs_cleanup() is called we copy hvcsd from
tty->driver_data which was previoulsy NULLed by hvcs_close() and our
call to tty_port_put(&hvcsd->port) doesn't actually do anything since
&hvcsd->port ends up translating to NULL by chance. This has the side
effect that when hvcs_remove() is called we have one too many port
references preventing hvcs_destuct_port() from ever being called. This
also prevents us from reusing the /dev/hvcsX node in a future
hvcs_probe() and we can eventually run out of /dev/hvcsX devices.

Fix this by waiting to NULL tty->driver_data in hvcs_cleanup().

Fixes: 27bf7c43a1 ("TTY: hvcs, add tty install")
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Link: https://lore.kernel.org/r/20200820234643.70412-1-tyreld@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:57:38 +01:00
..
Kconfig tty: remove redundant 'default n' from Kconfig-s 2019-04-16 15:21:33 +02:00
Makefile TTY/Serial driver patches for 4.17-rc1 2018-04-04 18:43:49 -07:00
hvc_console.c Revert "tty: hvc: Fix data abort due to race in hvc_open" 2020-06-30 15:37:13 -04:00
hvc_console.h tty: hvc: introduce the hv_ops.flush operation for hvc drivers 2018-07-23 20:13:20 +10:00
hvc_dcc.c tty: hvc: Remove redundant license text 2017-11-08 13:08:12 +01:00
hvc_irq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hvc_iucv.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
hvc_opal.c tty: Use of_node_name_{eq,prefix} for node name comparisons 2018-12-17 16:12:17 +01:00
hvc_riscv_sbi.c tty: Don't force RISCV SBI console as preferred console 2019-05-16 20:42:11 -07:00
hvc_rtas.c tty: hvc: Remove redundant license text 2017-11-08 13:08:12 +01:00
hvc_udbg.c tty: hvc: Remove redundant license text 2017-11-08 13:08:12 +01:00
hvc_vio.c powerpc/pseries/hvconsole: Fix stack overread via udbg 2019-06-14 15:35:53 +10:00
hvc_xen.c tty: hvc_xen: Mark expected switch fall-through 2019-02-26 12:30:44 +01:00
hvcs.c tty: hvcs: Don't NULL tty->driver_data until hvcs_cleanup() 2020-10-29 09:57:38 +01:00
hvsi.c tty: hvc: Remove redundant license text 2017-11-08 13:08:12 +01:00
hvsi_lib.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00