[PATCH net-next 12/14] rxrpc: Don't transmit an ACK if there's no reason set
From: David Howells
Date: Sat Sep 17 2016 - 19:19:26 EST
Don't transmit an ACK if call->ackr_reason in unset. There's the
possibility of a race between recvmsg() sending an ACK and the background
processing thread trying to send the same one.
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---
net/rxrpc/output.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 06a9aca739d1..aa0507214b31 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -137,6 +137,11 @@ int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type)
switch (type) {
case RXRPC_PACKET_TYPE_ACK:
spin_lock_bh(&call->lock);
+ if (!call->ackr_reason) {
+ spin_unlock_bh(&call->lock);
+ ret = 0;
+ goto out;
+ }
n = rxrpc_fill_out_ack(call, pkt);
call->ackr_reason = 0;