]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: (efi-lockdown) Lock down TIOCSSERIAL
authorDavid Howells <dhowells@redhat.com>
Wed, 7 Dec 2016 10:28:39 +0000 (10:28 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:34:07 +0000 (07:34 -0500)
Lock down TIOCSSERIAL as that can be used to change the ioport and irq
settings on a serial port.  This only appears to be an issue for the serial
drivers that use the core serial code.  All other drivers seem to either
ignore attempts to change port/irq or give an error.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David Howells <dhowells@redhat.com>
(cherry picked from commit 83bd921f9ac911f2644bdc5abd31dd4d56cfeb4e
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/tty/serial/serial_core.c

index f534a40aebdeeadba3f344f229f1b8ac067370d1..e32c0179f423c4aed9687c582bcd7000b14dbac2 100644 (file)
@@ -821,6 +821,12 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
        new_flags = new_info->flags;
        old_custom_divisor = uport->custom_divisor;
 
+       if ((change_port || change_irq) && kernel_is_locked_down()) {
+               pr_err("Using TIOCSSERIAL to change device addresses, irqs and dma channels is not permitted when the kernel is locked down\n");
+               retval = -EPERM;
+               goto exit;
+       }
+
        if (!capable(CAP_SYS_ADMIN)) {
                retval = -EPERM;
                if (change_irq || change_port ||