Commit a17c42f9 authored by David S. Miller's avatar David S. Miller
Browse files


David Howells says:

====================
Here are a couple of fixes for rxrpc:

 (1) Fix a potential deadlock in the peer keepalive dispatcher.

 (2) Fix a missing notification when a UDP sendmsg error occurs in rxrpc.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 5f4e4203 c69565ee
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1061,6 +1061,7 @@ void rxrpc_destroy_all_peers(struct rxrpc_net *);
struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *);
struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *);
void rxrpc_put_peer(struct rxrpc_peer *);
void rxrpc_put_peer_locked(struct rxrpc_peer *);

/*
 * proc.c
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ static void rxrpc_peer_keepalive_dispatch(struct rxrpc_net *rxnet,
		spin_lock_bh(&rxnet->peer_hash_lock);
		list_add_tail(&peer->keepalive_link,
			      &rxnet->peer_keepalive[slot & mask]);
		rxrpc_put_peer(peer);
		rxrpc_put_peer_locked(peer);
	}

	spin_unlock_bh(&rxnet->peer_hash_lock);
+18 −0
Original line number Diff line number Diff line
@@ -436,6 +436,24 @@ void rxrpc_put_peer(struct rxrpc_peer *peer)
	}
}

/*
 * Drop a ref on a peer record where the caller already holds the
 * peer_hash_lock.
 */
void rxrpc_put_peer_locked(struct rxrpc_peer *peer)
{
	const void *here = __builtin_return_address(0);
	int n;

	n = atomic_dec_return(&peer->usage);
	trace_rxrpc_peer(peer, rxrpc_peer_put, n, here);
	if (n == 0) {
		hash_del_rcu(&peer->hash_link);
		list_del_init(&peer->keepalive_link);
		kfree_rcu(peer, rcu);
	}
}

/*
 * Make sure all peer records have been discarded.
 */
+1 −0
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ static int rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
			rxrpc_set_call_completion(call,
						  RXRPC_CALL_LOCAL_ERROR,
						  0, ret);
			rxrpc_notify_socket(call);
			goto out;
		}
		_debug("need instant resend %d", ret);