]> git.baikalelectronics.ru Git - kernel.git/commit
SUNRPC: Fix a potential race in xprt_connect()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 2 Dec 2018 04:18:00 +0000 (23:18 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 2 Dec 2018 14:43:57 +0000 (09:43 -0500)
commit1c282641968c2b1fa6fb593d62f21a2ca6fb3f54
tree683288309ec67126269473e0d6a63ae01abbabae
parentb237752e850cc82bab70e7eb01f49b21dd74373e
SUNRPC: Fix a potential race in xprt_connect()

If an asynchronous connection attempt completes while another task is
in xprt_connect(), then the call to rpc_sleep_on() could end up
racing with the call to xprt_wake_pending_tasks().
So add a second test of the connection state after we've put the
task to sleep and set the XPRT_CONNECTING flag, when we know that there
can be no asynchronous connection attempts still in progress.

Fixes: bdc12ec88151d ("SUNRPC: Move the test for XPRT_CONNECTING into...")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xprt.c