lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  8 Dec 2021 03:47:41 +0530
From:   Vihas Mak <makvihas@...il.com>
To:     gregkh@...uxfoundation.org, jirislaby@...nel.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Vihas Mak <makvihas@...il.com>
Subject: [PATCH] tty: serial: return appropriate error on failure

when a user with CAP_SYS_ADMIN disabled calls ioctl (TIOCSSERIAL),
uart_set_info() returns 0 instead of -EPERM and the user remains unware
about what went wrong. Fix this.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215205

Signed-off-by: Vihas Mak <makvihas@...il.com>
---
 drivers/tty/serial/serial_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 61e3dd022..c204bdecc 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -960,7 +960,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
 		uport->fifosize = new_info->xmit_fifo_size;
 
  check_and_exit:
-	retval = 0;
+	retval = retval < 0 ? retval : 0;
 	if (uport->type == PORT_UNKNOWN)
 		goto exit;
 	if (tty_port_initialized(port)) {
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ