summaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2020-05-26 16:56:32 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-27 10:55:36 +0200
commit24eb2377f977fe06d84fca558f891f95bc28a449 (patch)
treec5d0a604006aec9b2ff62193243b69bb8ca382a6 /ipc
parent8f065acec7573672dd15916e31d1e9b2e785566c (diff)
tty: hvc_console, fix crashes on parallel open/close
hvc_open sets tty->driver_data to NULL when open fails at some point. Typically, the failure happens in hp->ops->notifier_add(). If there is a racing process which tries to open such mangled tty, which was not closed yet, the process will crash in hvc_open as tty->driver_data is NULL. All this happens because close wants to know whether open failed or not. But ->open should not NULL this and other tty fields for ->close to be happy. ->open should call tty_port_set_initialized(true) and close should check by tty_port_initialized() instead. So do this properly in this driver. So this patch removes these from ->open: * tty_port_tty_set(&hp->port, NULL). This happens on last close. * tty->driver_data = NULL. Dtto. * tty_port_put(&hp->port). This happens in shutdown and until now, this must have been causing a reference underflow, if I am not missing something. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: stable <stable@vger.kernel.org> Reported-and-tested-by: Raghavendra <rananta@codeaurora.org> Link: https://lore.kernel.org/r/20200526145632.13879-1-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions