提交 c5012564 编写于 作者: D David Howells 提交者: David S. Miller

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: 3d18cbb7 ("rxrpc: Fix conn expiry timers")
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 886afc1d
...@@ -860,6 +860,7 @@ static void rxrpc_sock_destructor(struct sock *sk) ...@@ -860,6 +860,7 @@ static void rxrpc_sock_destructor(struct sock *sk)
static int rxrpc_release_sock(struct sock *sk) static int rxrpc_release_sock(struct sock *sk)
{ {
struct rxrpc_sock *rx = rxrpc_sk(sk); struct rxrpc_sock *rx = rxrpc_sk(sk);
struct rxrpc_net *rxnet = rxrpc_net(sock_net(&rx->sk));
_enter("%p{%d,%d}", sk, sk->sk_state, refcount_read(&sk->sk_refcnt)); _enter("%p{%d,%d}", sk, sk->sk_state, refcount_read(&sk->sk_refcnt));
...@@ -895,8 +896,8 @@ static int rxrpc_release_sock(struct sock *sk) ...@@ -895,8 +896,8 @@ static int rxrpc_release_sock(struct sock *sk)
rxrpc_release_calls_on_socket(rx); rxrpc_release_calls_on_socket(rx);
flush_workqueue(rxrpc_workqueue); flush_workqueue(rxrpc_workqueue);
rxrpc_purge_queue(&sk->sk_receive_queue); rxrpc_purge_queue(&sk->sk_receive_queue);
rxrpc_queue_work(&rx->local->rxnet->service_conn_reaper); rxrpc_queue_work(&rxnet->service_conn_reaper);
rxrpc_queue_work(&rx->local->rxnet->client_conn_reaper); rxrpc_queue_work(&rxnet->client_conn_reaper);
rxrpc_put_local(rx->local); rxrpc_put_local(rx->local);
rx->local = NULL; rx->local = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册