Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Vihas Mak <makvihas@gmail.com>, gregkh@linuxfoundation.org
Cc: 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:53 +0100	[thread overview]
Message-ID: <3f96b310-74eb-5247-2ec3-bba9213e194d@kernel.org> (raw)
In-Reply-To: <20211207221741.50422-1-makvihas@gmail.com>

On 07. 12. 21, 23:17, 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;

This is wrong IMO. See:
https://bugzilla.kernel.org/show_bug.cgi?id=215205#c1

>   	if (uport->type == PORT_UNKNOWN)
>   		goto exit;
>   	if (tty_port_initialized(port)) {
> 


-- 
js
suse labs

  reply	other threads:[~2021-12-08  5:44 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 [this message]
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=3f96b310-74eb-5247-2ec3-bba9213e194d@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gregkh@linuxfoundation.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