RxRPC fixes

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEqG5UsNXhtOCrfGQP+7dXa6fLC2sFAl1AVHoACgkQ+7dXa6fL
 C2ud5A//YDOVP3btTmlY6JuaF+OIJheDL3MXcBZPtjjX4Vxt8B3Zyyxw7sIW5BQK
 RyWeGHardl1kU5ylGBsG5HsXio0JdAkF/VcK95qEfv1MAB9Js8dDQyM0YnK3Pb77
 wWJUzzeZIFAafv4pfRPzZV3d9El6UB4kFlRU2gvlT/pLSy4NAK/TN3r0S0Tr2Jzy
 6Rz3xPYOAnc7RDRLditrkgb0qBgda4RaYRAVZyhADjfXQQA6vKyXgoxFad7fFs0M
 YyYYd3/vCTLAruvK0ioOHMEDjNSnqJG7U9PLDTumf06RIQxTZ7lMHefh7kZSF6rH
 7LThoPP2skJSDqVJSTE7WJRZD1cEY48ORQhooFOmVFf0/rLMZS6zkFIpIY5fI/pL
 Iyw8Wxvuq7xkXCDqg5Z5KaatSxljnvQpr+qW6mWPKaedzbrBQVGfAVuGqjrxpPsz
 IsNzuk6bSNqqUKjtMvIGEXM6iKgpVfV05ONS8QNpdhIWakxcz/RmOhXHXejxUYLr
 sDCzafDUFn0yris92ENyZPg3tb4qYuGU67LMl79ziXViDCyIzXycWwy9UlkYaGGv
 6W9XJt2y4DyGJvf3Tfyh8hk/LIR0RAOXQgzkIko/1jpALRR3IX3+xdj4BcYnH/Gw
 OXj5CpfqEhzN4kfGhtgloPS1GCyyiUnelEV48z3IM/0SsGQiL+8=
 =+jjQ
 -----END PGP SIGNATURE-----

Merge tag 'rxrpc-fixes-20190730' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

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: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2019-07-30 10:31:25 -07:00
commit a17c42f968
4 changed files with 21 additions and 1 deletions

View File

@ -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

View File

@ -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);

View File

@ -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.
*/

View File

@ -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);