]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: (efi-lockdown) Lock down TIOCSSERIAL
authorDavid Howells <dhowells@redhat.com>
Wed, 24 May 2017 13:56:06 +0000 (14:56 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 29 Jan 2018 13:45:02 +0000 (07:45 -0600)
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>
cc: Jiri Slaby <jslaby@suse.com>
(cherry picked from commit 8d8c1da752c5ea837f1dbe06fa21d4ca891fcd83
 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 854995e1cae7d0d256d35d4d048836747ad81063..89fed5294c7648d253e70a0a57cba7548f4e33fc 100644 (file)
@@ -829,6 +829,12 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
        new_flags = (__force upf_t)new_info->flags;
        old_custom_divisor = uport->custom_divisor;
 
+       if ((change_port || change_irq) &&
+           kernel_is_locked_down("Using TIOCSSERIAL to change device addresses, irqs and dma channels")) {
+               retval = -EPERM;
+               goto exit;
+       }
+
        if (!capable(CAP_SYS_ADMIN)) {
                retval = -EPERM;
                if (change_irq || change_port ||