From: Vihas Mak <makvihas@gmail.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Vihas Mak <makvihas@gmail.com>
Subject: [PATCH] tty: serial: return appropriate error on failure
Date: Wed, 8 Dec 2021 03:47:41 +0530 [thread overview]
Message-ID: <20211207221741.50422-1-makvihas@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2021-12-07 22:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 22:17 Vihas Mak [this message]
2021-12-08 5:44 ` [PATCH] tty: serial: return appropriate error on failure Jiri Slaby
2021-12-08 5:44 ` Greg KH
2021-12-08 14:12 ` Vihas Mak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211207221741.50422-1-makvihas@gmail.com \
--to=makvihas@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox