From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6A923E717A for ; Tue, 2 Jun 2026 13:36:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780407378; cv=none; b=lV94apoC3JqHDJGPakywco4IrRBId+RqrSKEMnQjPjOvwGgudBESCdUkxjgiAAyhZxBrVkfMkvwVuouuZMB9iM5axAELlYSwK28XBPtG9MziBzv0l1aX7mmtIzanBJiMjOsZcdPcWdTkzoBUBpJCn4GPEP6JiEnz/z8f33DBW9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780407378; c=relaxed/simple; bh=+FB2mNWD+mMTqn+F3bRCt0nRITKgPpAcXTfxbti41GQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ryCDwprZRBgc0es2d1ZQXNBhmhpkIap0aUi1F+CnT2lqLyKrDh4fl9mbgVLXXXDodmPOgpgIItB1v7b09pDT46CQX8XddqmWVkjOdEW83lAc4YTpfdFX7S1stIP8eod0pLaM2EmOk+k950hytyAd9D/CjcZ3aGEA7JjoExOfVjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Uc9R733G; arc=none smtp.client-ip=209.85.222.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Uc9R733G" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-91550eca866so387238085a.1 for ; Tue, 02 Jun 2026 06:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780407373; x=1781012173; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yRqKUEmLg14tZiwShSZMSTmsfzqKmm+Rz87fQO4vv/I=; b=Uc9R733G+cOXJQmf/GRCdjld2bKOp2SwYWqTcjlPb9gNGuZCZwJHrV/7ffi2hcLqvI GcLC3ucQDgxas4KV51XsJTuuOwAIzRCUoGthgU+nXIgXtxlj/ESHQS7vXw+rkR74Kvyi ThmZLztLToL9OG5mO7itBUBi/XKQuVO80fez9ozxBwgRVyEtOnE+zOixWIOTgSUXhB64 ocYQn5tJWyg9BGO5zz0jEyFOhS5QtQEwrS5CechsRc/YdT7CHIUNCxhVFdFM6KR56FVM WHeuuja0Dfq9sfz13J2Z0Kh0TFNSFASDl+tak7Kfj+7ufrA4mAZXrNvt63fGlDs1vCPv J9jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780407373; x=1781012173; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yRqKUEmLg14tZiwShSZMSTmsfzqKmm+Rz87fQO4vv/I=; b=OHKt7lTxU9nGvVhe7Ki5IPqphad8RGrruOvLZnQ6eQl4UL1oEYrJG5PWU1+avrdBOk SreaO4MU2QjdA31X4Y0Jkh4kaIuRLPwtw/Guzdn2XxD9P91DhYrStQBOmG+TuQ3yT+v1 xcvZb8DzUtpuf57YTg7cqB5CflOn+XBk4G8h5ExC3hSaIWlJFYiRueIPpuqfBhz8LSKp R7gb7kKU552LKedxnrufcv3Tfe/XAxcfSFYiSd4r5vhruAax/tYlyPYuDjMylVK+yhK+ OzGoq41ZJrJQ1XUS+8jUc4slXsZjo0+qLtUm/UZqVX88SRIA01RLOcnVVq9NkNGIqsd3 wScA== X-Forwarded-Encrypted: i=1; AFNElJ8QuhIAqEX0il2ampHkPaUj+vZHgEpcRPhuxTJV6F8dp1e3QlnugKfw+PYrRJrwMBsD70SvQ2Wiw/zDMaw=@vger.kernel.org X-Gm-Message-State: AOJu0YzMJLRFyVnGhZXQNhTeF/SAig++SqG9uOhyQAwk/+c7bMHjFZ0y IOTuWjWHCknyiQQZql/5GU1QhajFKzZZ6PQvZ9M71hNAtzIN9M/GCijB X-Gm-Gg: Acq92OHuQKbOeHSWTsH2k2Inezxb6U2pg3TsyglCQNlQGZ92LnQeVSH9D+sLosQP70W hEG0D/wR70v+vA5Co6aFZKrJlayyo9N7qck3OrEXAfzyy25rGyns0PD03wnzDBB6R/RH7Q7WEXF wiL4ebPqX2+T04aVeWsvePZ6Stbp2VyIYPi0AeTZ2+fLQQ1DGMKUgtoxFvVBoZZdPGh91AmjA2X iC+HFJBGDS/p6vuh6ytaKVgmAVx/FsODTmHSRifcCvRJmqJ8y5mMRuqjHeVjwB+hjV0MFvULUSF VfilpDMlX22S+Yw+m6AQNs0u0dLBfNfTfOZ9qOryAwYInvFoTTu+/xB0yp8jXwcm/LNUojCamo9 YFeq/LXAvO4kF2+IOlYj3XZs3bFYbSZioeJAhSDXWaLQyGDON4dFITlyfOn75GXaaTf1uLF2NS3 qAOWiULZCDRfOt3jXzSWMbKbe+MrRb+h+jgdcsWznzHjX24U7dHW4oaZ+DArIMpHb2M+HzF4Qe5 vpqKJYGcDUcwqyzbFFXh/X0gQYBeyE= X-Received: by 2002:a05:620a:4015:b0:915:7b5e:a4c4 with SMTP id af79cd13be357-9157b5eb1fbmr401346585a.45.1780407373453; Tue, 02 Jun 2026 06:36:13 -0700 (PDT) Received: from server0 (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54]) by smtp.gmail.com with ESMTPSA id af79cd13be357-915721f7d75sm346036285a.18.2026.06.02.06.36.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 06:36:12 -0700 (PDT) From: Michael Bommarito To: Jon Maloy , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , Ying Xue , netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH net 3/4] tipc: prevent snt_unacked underflow on CONN_ACK Date: Tue, 2 Jun 2026 09:35:54 -0400 Message-ID: <20260602133555.769727-4-michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260602133555.769727-1-michael.bommarito@gmail.com> References: <20260602133555.769727-1-michael.bommarito@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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. Cap the ack to the outstanding count before subtracting. 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") Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Michael Bommarito --- net/tipc/socket.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 9329919fb07f0..9c739a3cea126 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1362,9 +1362,16 @@ 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) { + u16 conn_ack = msg_conn_ack(hdr); + was_cong = tsk_conn_cong(tsk); tipc_sk_push_backlog(tsk, msg_nagle_ack(hdr)); - tsk->snt_unacked -= msg_conn_ack(hdr); + /* Cap a peer-supplied ack so a forged value cannot underflow + * the unsigned counter and wedge connection flow control. + */ + if (conn_ack > tsk->snt_unacked) + conn_ack = tsk->snt_unacked; + tsk->snt_unacked -= conn_ack; if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) tsk->snd_win = msg_adv_win(hdr); if (was_cong && !tsk_conn_cong(tsk)) -- 2.53.0