diff options
author | David Howells <dhowells@redhat.com> | 2018-03-30 22:05:33 +0200 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-03-30 22:05:33 +0200 |
commit | 31f5f9a1691ebef2113c8bdb3edcb8859f30f702 (patch) | |
tree | 20de5ce61ea1a3aad4e58426e24b038203c53af8 /net/rxrpc/call_accept.c | |
parent | rxrpc: Add a tracepoint to track rxrpc_local refcounting (diff) | |
download | linux-31f5f9a1691ebef2113c8bdb3edcb8859f30f702.tar.xz linux-31f5f9a1691ebef2113c8bdb3edcb8859f30f702.zip |
rxrpc: Fix apparent leak of rxrpc_local objects
rxrpc_local objects cannot be disposed of until all the connections that
point to them have been RCU'd as a connection object holds refcount on the
local endpoint it is communicating through. Currently, this can cause an
assertion failure to occur when a network namespace is destroyed as there's
no check that the RCU destructors for the connections have been run before
we start trying to destroy local endpoints.
The kernel reports:
rxrpc: AF_RXRPC: Leaked local 0000000036a41bc1 {5}
------------[ cut here ]------------
kernel BUG at ../net/rxrpc/local_object.c:439!
Fix this by keeping a count of the live connections and waiting for it to
go to zero at the end of rxrpc_destroy_all_connections().
Fixes: dee46364ce6f ("rxrpc: Add RCU destruction for connections and calls")
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/call_accept.c')
-rw-r--r-- | net/rxrpc/call_accept.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c index 5a9b1d916124..f67017dcb25e 100644 --- a/net/rxrpc/call_accept.c +++ b/net/rxrpc/call_accept.c @@ -219,6 +219,8 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx) list_del(&conn->proc_link); write_unlock(&rxnet->conn_lock); kfree(conn); + if (atomic_dec_and_test(&rxnet->nr_conns)) + wake_up_atomic_t(&rxnet->nr_conns); tail = (tail + 1) & (size - 1); } |