lkml.org 
[lkml]   [2021]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] tty: serial: return appropriate error on failure
From
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

\
 
 \ /
  Last update: 2021-12-08 06:45    [W:0.040 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site