All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: David Howells <dhowells@redhat.com>
Cc: netdev@vger.kernel.org,
	Baptiste Lepers <baptiste.lepers@gmail.com>,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] rxrpc: Call state should be read with READ_ONCE() under some circumstances
Date: Tue, 12 Jan 2021 18:25:33 -0800	[thread overview]
Message-ID: <20210112182533.13b1c787@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <161046715522.2450566.488819910256264150.stgit@warthog.procyon.org.uk>

On Tue, 12 Jan 2021 15:59:15 +0000 David Howells wrote:
> From: Baptiste Lepers <baptiste.lepers@gmail.com>
> 
> The call state may be changed at any time by the data-ready routine in
> response to received packets, so if the call state is to be read and acted
> upon several times in a function, READ_ONCE() must be used unless the call
> state lock is held.
> 
> As it happens, we used READ_ONCE() to read the state a few lines above the
> unmarked read in rxrpc_input_data(), so use that value rather than
> re-reading it.
> 
> Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
> Signed-off-by: David Howells <dhowells@redhat.com>

Fixes: a158bdd3247b ("rxrpc: Fix call timeouts")

maybe?

> diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
> index 667c44aa5a63..dc201363f2c4 100644
> --- a/net/rxrpc/input.c
> +++ b/net/rxrpc/input.c
> @@ -430,7 +430,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)
>  		return;
>  	}
>  
> -	if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) {
> +	if (state == RXRPC_CALL_SERVER_RECV_REQUEST) {
>  		unsigned long timo = READ_ONCE(call->next_req_timo);
>  		unsigned long now, expect_req_by;
>  
> 
> 


  reply	other threads:[~2021-01-13  2:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 15:59 [PATCH net] rxrpc: Call state should be read with READ_ONCE() under some circumstances David Howells
2021-01-13  2:25 ` Jakub Kicinski [this message]
2021-01-13  8:23 ` David Howells
2021-01-13 18:41   ` Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2017-03-04  0:01 David Howells
2017-03-07 21:59 ` David Miller

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=20210112182533.13b1c787@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=baptiste.lepers@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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.