From: Greg KH <gregkh@linuxfoundation.org>
To: Vihas Mak <makvihas@gmail.com>
Cc: jirislaby@kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: serial: return appropriate error on failure
Date: Wed, 8 Dec 2021 06:44:56 +0100 [thread overview]
Message-ID: <YbBGWH0lPs3NBLQr@kroah.com> (raw)
In-Reply-To: <20211207221741.50422-1-makvihas@gmail.com>
On Wed, Dec 08, 2021 at 03:47:41AM +0530, Vihas Mak wrote:
> 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;
Please no, do not use ? : unless you have to. Spell it out and use a
real if statement.
thanks,
greg k-h
next prev parent reply other threads:[~2021-12-08 5:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 22:17 [PATCH] tty: serial: return appropriate error on failure Vihas Mak
2021-12-08 5:44 ` Jiri Slaby
2021-12-08 5:44 ` Greg KH [this message]
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=YbBGWH0lPs3NBLQr@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=makvihas@gmail.com \
/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