]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tipc: prevent snt_unacked underflow on CONN_ACK
authorMichael Bommarito <michael.bommarito@gmail.com>
Wed, 10 Jun 2026 12:40:02 +0000 (08:40 -0400)
committerJakub Kicinski <kuba@kernel.org>
Thu, 11 Jun 2026 23:01:16 +0000 (16:01 -0700)
tipc_sk_conn_proto_rcv() subtracts the peer-supplied connection ack count
from the unsigned 16-bit send counter snt_unacked without checking that it
does not exceed the number of messages actually outstanding:

tsk->snt_unacked -= msg_conn_ack(hdr);

msg_conn_ack() is read straight from a received CONN_MANAGER/CONN_ACK
message. If the ack count is larger than snt_unacked, the subtraction
wraps to a near-maximum value, leaving tsk_conn_cong() permanently true
and starving the connection of further transmits.

Validate the ACK count at the start of the CONN_ACK block and drop the
message if it acknowledges more messages than are outstanding. A peer (or,
for a local connection, the connected peer socket) can otherwise wedge a
TIPC connection's send side by sending an oversized connection ack.

Fixes: 10724cc7bb78 ("tipc: redesign connection-level flow control")
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Link: https://patch.msgid.link/20260610124003.3831170-3-michael.bommarito@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/tipc/socket.c

index 9329919fb07f074a8a9d6c1b3a7bacd86083bb64..f64f7a35b5c9109517ae36d5a659bafba99f5156 100644 (file)
@@ -1362,6 +1362,9 @@ static void tipc_sk_conn_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb,
                        __skb_queue_tail(xmitq, skb);
                return;
        } else if (mtyp == CONN_ACK) {
+               if (tsk->snt_unacked < msg_conn_ack(hdr))
+                       goto exit;
+
                was_cong = tsk_conn_cong(tsk);
                tipc_sk_push_backlog(tsk, msg_nagle_ack(hdr));
                tsk->snt_unacked -= msg_conn_ack(hdr);