[PATCH v2 46/57][X] UBUNTU: SAUCE: (efi-lockdown) Lock down TIOCSSERIAL

Seth Forshee seth.forshee at canonical.com
Fri Jun 19 16:49:59 UTC 2020


From: David Howells <dhowells at redhat.com>

BugLink: https://bugs.launchpad.net/bugs/1884159

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 at linuxfoundation.org>
Signed-off-by: David Howells <dhowells at redhat.com>
cc: Jiri Slaby <jslaby at suse.com>
(backported from commit 8d8c1da752c5ea837f1dbe06fa21d4ca891fcd83
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <seth.forshee at canonical.com>
---
 drivers/tty/serial/serial_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 013fb874c64e..51271d62a7a1 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -768,6 +768,11 @@ 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) && secure_modules()) {
+		retval = -EPERM;
+		goto exit;
+	}
+
 	if (!capable(CAP_SYS_ADMIN)) {
 		retval = -EPERM;
 		if (change_irq || change_port ||
-- 
2.27.0




More information about the kernel-team mailing list