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] [day] [month] [year] [list]
Message-ID: <014b511a-0542-d85d-e1dc-943e5463da17@kernel.org>
Date:   Mon, 12 Jul 2021 08:16:57 +0200
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Zheyu Ma <zheyuma97@...il.com>, gregkh@...uxfoundation.org,
        rclemsmith@...il.com
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tty: serial: jsm: hold port lock when reporting modem
 line changes

On 10. 07. 21, 16:05, Zheyu Ma wrote:
> uart_handle_dcd_change() requires a port lock to be held and will emit a
> warning when lockdep is enabled.

Please attach an excerpt from the warning to the commit log.

> Held corresponding lock to fix warnings.
> 
> Signed-off-by: Zheyu Ma <zheyuma97@...il.com>
> ---
>   drivers/tty/serial/jsm/jsm_neo.c | 2 ++
>   drivers/tty/serial/jsm/jsm_tty.c | 3 +++
>   2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
> index bf0e2a4cb0ce..c6f927a76c3b 100644
> --- a/drivers/tty/serial/jsm/jsm_neo.c
> +++ b/drivers/tty/serial/jsm/jsm_neo.c
> @@ -815,7 +815,9 @@ static void neo_parse_isr(struct jsm_board *brd, u32 port)
>   		/* Parse any modem signal changes */
>   		jsm_dbg(INTR, &ch->ch_bd->pci_dev,
>   			"MOD_STAT: sending to parse_modem_sigs\n");
> +		spin_lock_irqsave(&ch->uart_port.lock, lock_flags);
>   		neo_parse_modem(ch, readb(&ch->ch_neo_uart->msr));
> +		spin_unlock_irqrestore(&ch->uart_port.lock, lock_flags);
>   	}
>   }
>   
> diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
> index 8e42a7682c63..d74cbbbf33c6 100644
> --- a/drivers/tty/serial/jsm/jsm_tty.c
> +++ b/drivers/tty/serial/jsm/jsm_tty.c
> @@ -187,6 +187,7 @@ static void jsm_tty_break(struct uart_port *port, int break_state)
>   
>   static int jsm_tty_open(struct uart_port *port)
>   {
> +	unsigned long lock_flags;
>   	struct jsm_board *brd;
>   	struct jsm_channel *channel =
>   		container_of(port, struct jsm_channel, uart_port);
> @@ -240,6 +241,7 @@ static int jsm_tty_open(struct uart_port *port)
>   	channel->ch_cached_lsr = 0;
>   	channel->ch_stops_sent = 0;
>   
> +	spin_lock_irqsave(&port->lock, lock_flags);
>   	termios = &port->state->port.tty->termios;
>   	channel->ch_c_cflag	= termios->c_cflag;
>   	channel->ch_c_iflag	= termios->c_iflag;
> @@ -259,6 +261,7 @@ static int jsm_tty_open(struct uart_port *port)
>   	jsm_carrier(channel);
>   
>   	channel->ch_open_count++;
> +	spin_unlock_irqrestore(&port->lock, lock_flags);
>   
>   	jsm_dbg(OPEN, &channel->ch_bd->pci_dev, "finish\n");
>   	return 0;
> 


-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ