tty/vt: handle bad user buffer in {G,P}IO_CMAP ioctl
commit871bdea6f8c64517635bec352b8bec6b72a26d80
authorMichael Gehring <mg@ebfe.org>
Wed, 21 Mar 2012 00:26:45 +0000 (21 01:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Apr 2012 19:10:23 +0000 (9 12:10 -0700)
tree786a6dede8222338409a05e316cf58435ee97e72
parentef4f9d4f09265b60fcb6bfa31a614ea84a72b7a8
tty/vt: handle bad user buffer in {G,P}IO_CMAP ioctl

set_get_cmap() ignored the result of {get,put}_user(), causing ioctl(vt,
{G,P}IO_CMAP, 0xdeadbeef) to silently fail.

Another side effect of this: calling the PIO_CMAP ioctl with an invalid
buffer would zero the default colormap and the palette for all vts (all
colors set to black).

Leave the default colormap intact and return -EFAULT when
reading/writing to the userspace buffer fails.

Signed-off-by: Michael Gehring <mg@ebfe.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/vt.c