mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 23:51:02 +02:00
tty: vcc: hold port lock when clearing tty pointer in vcc_cleanup
vcc_cleanup() sets port->tty to NULL without holding port->lock, racing with vcc_event() LDC callbacks that read port->tty under port->lock and then use tty->port. This can cause a use-after-free when the callback dereferences tty->port after cleanup has already destroyed and freed it. Assisted-by: AISLE:Snapshot Cc: stable <stable@kernel.org> Signed-off-by: Joshua Rogers <linux@joshua.hu> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://patch.msgid.link/20260803-aisle-tty-vcc-v2-2-a50bc9b15193@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1f71f565e3
commit
03b49c991a
|
|
@ -986,7 +986,8 @@ static void vcc_cleanup(struct tty_struct *tty)
|
|||
|
||||
port = vcc_get(tty->index, true);
|
||||
if (port) {
|
||||
port->tty = NULL;
|
||||
scoped_guard(spinlock_irqsave, &port->lock)
|
||||
port->tty = NULL;
|
||||
|
||||
if (port->removed) {
|
||||
vcc_table_remove(tty->index);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user