All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: jaidevshastri@vt.edu
Cc: Russell King <linux@armlinux.org.uk>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: amba-pl011: publish amba_ports[] entries with release semantics
Date: Wed, 23 Sep 2026 14:09:51 +0200	[thread overview]
Message-ID: <2026092307-congress-glance-4a36@gregkh> (raw)
In-Reply-To: <20260921-mb-pl011-v1-1-b378bb057d43@vt.edu>

On Mon, Sep 21, 2026 at 09:20:12PM -0400, Jaidev Shastri via B4 Relay wrote:
> From: Jaidev Shastri <jaidevshastri@vt.edu>
> 
> pl011_setup_port() fills the port structure and then stores its address
> into amba_ports[] with a plain store. The console callbacks read the
> slot through co->index with plain loads.
> 
> Store the slot with smp_store_release() and read it with
> smp_load_acquire().
> 
> Found with MBCheck, a static herd7-based memory consistency checker.
> 
> Signed-off-by: Jaidev Shastri <jaidevshastri@vt.edu>
> ---
>  drivers/tty/serial/amba-pl011.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index c4824c201..696c12ca9 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2536,7 +2536,8 @@ static int pl011_console_setup(struct console *co, char *options)
>  	 */
>  	if (co->index >= UART_NR)
>  		co->index = 0;
> -	uap = amba_ports[co->index];
> +	/* Pairs with the smp_store_release() in pl011_setup_port(). */
> +	uap = smp_load_acquire(&amba_ports[co->index]);

That is usually wrong and not how to do this :(

Pleaase fix this properly, if it actually is a real issue.

thanks,

greg k-h

      parent reply	other threads:[~2026-09-23 12:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  1:20 [PATCH] serial: amba-pl011: publish amba_ports[] entries with release semantics Jaidev Shastri via B4 Relay
2026-09-22  1:20 ` Jaidev Shastri
2026-09-22  1:28 ` sashiko-bot
2026-09-23 12:09 ` Greg Kroah-Hartman [this message]

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=2026092307-congress-glance-4a36@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=jaidevshastri@vt.edu \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.