tty: make FONTX ioctl use the tty pointer they were actually passed
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 26 Oct 2020 20:15:23 +0000 (13:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:08:54 +0000 (11:08 +0100)
commit619e366268e0430687d07b24b48f7382fc088c9f
treeeb02942597897f56c01c7ae3f37e49a45560bb73
parent90553a7466d0bf67ed67d84c5ea01bf6fc9c821a
tty: make FONTX ioctl use the tty pointer they were actually passed

commit 90bfdeef83f1d6c696039b6a917190dcbbad3220 upstream.

Some of the font tty ioctl's always used the current foreground VC for
their operations.  Don't do that then.

This fixes a data race on fg_console.

Side note: both Michael Ellerman and Jiri Slaby point out that all these
ioctls are deprecated, and should probably have been removed long ago,
and everything seems to be using the KDFONTOP ioctl instead.

In fact, Michael points out that it looks like busybox's loadfont
program seems to have switched over to using KDFONTOP exactly _because_
of this bug (ahem.. 12 years ago ;-).

Reported-by: Minh Yuan <yuanmingbuaa@gmail.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Jiri Slaby <jirislaby@kernel.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/vt_ioctl.c