From: David Miller <davem@davemloft.net>
To: dhowells@redhat.com
Cc: netdev@vger.kernel.org, marc.dionne@auristor.com,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] rxrpc: Fix client call connect/disconnect race
Date: Fri, 08 Mar 2019 11:26:33 -0800 (PST) [thread overview]
Message-ID: <20190308.112633.1040548315975715311.davem@davemloft.net> (raw)
In-Reply-To: <155204931903.22787.5981080627556318769.stgit@warthog.procyon.org.uk>
From: David Howells <dhowells@redhat.com>
Date: Fri, 08 Mar 2019 12:48:39 +0000
> rxrpc_disconnect_client_call() reads the call's connection ID protocol
> value (call->cid) as part of that function's variable declarations. This
> is bad because it's not inside the locked section and so may race with
> someone granting use of the channel to the call.
>
> This manifests as an assertion failure (see below) where the call in the
> presumed channel (0 because call->cid wasn't set when we read it) doesn't
> match the call attached to the channel we were actually granted (if 1, 2 or
> 3).
>
> Fix this by moving the read and dependent calculations inside of the
> channel_lock section. Also, only set the channel number and pointer
> variables if cid is not zero (ie. unset).
>
> This problem can be induced by injecting an occasional error in
> rxrpc_wait_for_channel() before the call to schedule().
>
> Make two further changes also:
>
> (1) Add a trace for wait failure in rxrpc_connect_call().
>
> (2) Drop channel_lock before BUG'ing in the case of the assertion failure.
>
> The failure causes a trace akin to the following:
...
> Fixes: 45025bceef17 ("rxrpc: Improve management and caching of client connection objects")
> Signed-off-by: David Howells <dhowells@redhat.com>
> Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
Applied, thanks David.
prev parent reply other threads:[~2019-03-08 19:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 12:48 [PATCH net] rxrpc: Fix client call connect/disconnect race David Howells
2019-03-08 19:26 ` David Miller [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=20190308.112633.1040548315975715311.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).