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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60678c81-27bf-6f37-bae5-ccc91d714204@kernel.org>
Date:   Mon, 4 Jul 2022 08:51:52 +0200
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        linux-serial@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Vladimir Zapolskiy <vz@...ia.com>,
        Russell King <linux@...linux.org.uk>,
        Richard Genoud <richard.genoud@...il.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Beznea <claudiu.beznea@...rochip.com>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-stm32@...md-mailman.stormreply.com
Cc:     Lukas Wunner <lukas@...ner.de>,
        Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
        Lino Sanfilippo <LinoSanfilippo@....de>
Subject: Re: [PATCH v9 4/6] serial: take termios_rwsem for ->rs485_config() &
 pass termios as param

On 24. 06. 22, 22:42, Ilpo Järvinen wrote:
> To be able to alter ADDRB within ->rs485_config(), take termios_rwsem
> before calling ->rs485_config() and pass termios.

OK, FTR, worth noting the tty->termios_rwsem -> port->mutex lock chain 
is preexisting.

Anyway, I'm not sure I buy the above. Why is termios_rwsem needed to 
alter ADDRB?

> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 621fc15e2e54..44c3785445e3 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
...
> @@ -1511,6 +1511,10 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
>   	if (ret != -ENOIOCTLCMD)
>   		goto out;
>   
> +	/* rs485_config requires more locking than others */
> +	if (cmd == TIOCGRS485)
> +		down_write(&tty->termios_rwsem);
> +
>   	mutex_lock(&port->mutex);
>   	uport = uart_port_check(state);
>   
...
> @@ -1551,6 +1555,8 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
>   	}
>   out_up:
>   	mutex_unlock(&port->mutex);
> +	if (cmd == TIOCGRS485)
> +		up_write(&tty->termios_rwsem);
>   out:
>   	return ret;
>   }

thanks,
-- 
js

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ