Skip to content

Commit c501256

Browse files
dhowellsdavem330
authored andcommitted
rxrpc: Use correct netns source in rxrpc_release_sock()
In rxrpc_release_sock() there may be no rx->local value to access, so we can't unconditionally follow it to the rxrpc network namespace information to poke the connection reapers. Instead, use the socket's namespace pointer to find the namespace. This unfixed code causes the following static checker warning: net/rxrpc/af_rxrpc.c:898 rxrpc_release_sock() error: we previously assumed 'rx->local' could be null (see line 887) Fixes: 3d18cbb ("rxrpc: Fix conn expiry timers") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: David Howells <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 886afc1 commit c501256

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/rxrpc/af_rxrpc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ static void rxrpc_sock_destructor(struct sock *sk)
860860
static int rxrpc_release_sock(struct sock *sk)
861861
{
862862
struct rxrpc_sock *rx = rxrpc_sk(sk);
863+
struct rxrpc_net *rxnet = rxrpc_net(sock_net(&rx->sk));
863864

864865
_enter("%p{%d,%d}", sk, sk->sk_state, refcount_read(&sk->sk_refcnt));
865866

@@ -895,8 +896,8 @@ static int rxrpc_release_sock(struct sock *sk)
895896
rxrpc_release_calls_on_socket(rx);
896897
flush_workqueue(rxrpc_workqueue);
897898
rxrpc_purge_queue(&sk->sk_receive_queue);
898-
rxrpc_queue_work(&rx->local->rxnet->service_conn_reaper);
899-
rxrpc_queue_work(&rx->local->rxnet->client_conn_reaper);
899+
rxrpc_queue_work(&rxnet->service_conn_reaper);
900+
rxrpc_queue_work(&rxnet->client_conn_reaper);
900901

901902
rxrpc_put_local(rx->local);
902903
rx->local = NULL;

0 commit comments

Comments
 (0)