tty: Fix ->pgrp locking in tiocspgrp()
tiocspgrp() takes two tty_struct pointers: One to the tty that userspace passed to ioctl() (`tty`) and one to the TTY being changed (`real_tty`). These pointers are different when ioctl() is called with a master fd. To properly lock real_tty->pgrp, we must take real_tty->ctrl_lock. This bug makes it possible for racing ioctl(TIOCSPGRP, ...) calls on both sides of a PTY pair to corrupt the refcount of `struct pid`, leading to use-after-free errors. Fixes: 47f86834 ("redo locking of tty->pgrp") CC: stable@kernel.org Signed-off-by:Jann Horn <jannh@google.com> Reviewed-by:
Jiri Slaby <jirislaby@kernel.org> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Loading
-
mentioned in commit ce8e1973
-
mentioned in commit dadb44ac
-
mentioned in commit 0bd79c32
-
mentioned in commit a75d0770
-
mentioned in commit ed3ba7c8
-
mentioned in commit dabe6d05
-
mentioned in commit c4cdb615
-
mentioned in commit ab65e47b
-
mentioned in commit 5ddc689c
-
mentioned in commit 48062df9
-
mentioned in commit 4a6687b0
-
mentioned in commit c5dee337
Please sign in to comment