From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 5EBA72690EC for ; Sat, 6 Jun 2026 19:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780773278; cv=none; b=GFJrMHEfEnXhdQptVRXbksQRQlezLJioQMp+HCeH3F4KmMKE110kDQspkmX89ZKgWhIMoo+HTO09ITbrgq/2LLXN/N65xMOXYgsSb4TULQPSEabPPEzam8uRYMYcbH6R/EE066wt4iO2KHx14f7abg1yAZrOEja4Y3mTuRsGyus= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780773278; c=relaxed/simple; bh=/WGTThKiWoXaSPSBRFPFPXRr9IPffFu1oz4NhaY1Lps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bj44PF4vKdPrAuFI2eNXR+eQaQnWVszpJ7vIonKazyF/LU76LbIfZevwFAG8pfptUYqGRE701jtNgRMJa1ryfJ7MWjSwqMMUktcsFwUX6HO7+xvrG1Cp+MPqeVJbsyKw2suO8sKF6Bbe6kZ1Gj4h/HVe5DxUgkP7jn4fGKwBKkI= 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=aUoq7vUA; arc=none smtp.client-ip=209.85.222.170 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="aUoq7vUA" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-91587626ae1so349431485a.3 for ; Sat, 06 Jun 2026 12:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780773274; x=1781378074; 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=GjaADf0iYzsBqrk/kDn29iyRmVw1j4V13eigHGwqym8=; b=aUoq7vUAiLBJvx9PivNDG3JP9yHFffC/m/QADat2PITOqc57BZIHZkK25tNTvjPVJB 1qO61ueZ1JatUw0F6gbt3S/u58M1ASW5/wzSfIswe0fC1mLnW1MpOo+4qvzxt4YEiSHM tR6ETKUx211ABjX9ODIyhUw8HNuwdT2TopCl0n6k2d7IHJW75yLnApCHSKYN9kXDUKAk QM7InWAi8TNiTZNTuANXcNv+hhCPsRRYdUBy6qa3GOljPX54UbfPo1OogK00B9OnXt9O jUMmzhs8Xss8ZeQIt31wrGgC7TEWH8hKfAEYK+6aI3CFfQyGAXQtoRb01sR+ZS5KLhc3 tIjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780773274; x=1781378074; 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=GjaADf0iYzsBqrk/kDn29iyRmVw1j4V13eigHGwqym8=; b=lLveRveIfAPdqw+1sWNhx4VM6NLAmLCNEtGhwnHaUerTa1/qkVE9a7wTPBjn2io3Xm G/R88tSRZkqmGTXU1Dv8OSuDxd2s6kAbcdwV5lkdvFmrvJXR0rQbNud4ifCO+UBkyIMO 4DeKlg11HbpEw8CVTH7dsKaTVMKlvzdGKVvyWv/DrGXp/yNzFZnAgqhf1yi6ojgs3UHm gkkahXS9jRCyTB8eKIJqjSGxlPQv3aGUqZnnTtMRf4TiqgCRHphrqXfl5Vl8fwboOJV1 JAzm/qqchpwpojcKztmkSKLYBa5d2cyyu5FCixbtXrrnleTgh2z6egVnFFi7Zk3KW6Rb Ezxg== X-Forwarded-Encrypted: i=1; AFNElJ9ZbZy3c1mNPHprq41g8bXTvOVRdtvBszOterH52kihjRjpHlxMI3HgHqqHv+gOY9pBftwXd2RXeFZC2lg=@vger.kernel.org X-Gm-Message-State: AOJu0YyweLtSQeqFgbSZngEKChmvAOsZIURNlM3QNYXEnhKQdrK7Tk8J 3Jhyr8PkyDDLLhktC0vSknqe4JR+dw08wjPZiV6BX3EqgadNZAUXB84t X-Gm-Gg: Acq92OFnFjKz5snr3QtdsdTt++5kgm9kSLjBbjAc6KJfNUxqVrG+wgUUAp/bqyTLJxs eON4tXB3cNg6TUmjPip6iJZ/aMNSyQgZIx7M0APCFAPvxR9dmVymm4ThBV+FRz4xicM6ojXTchh grqIhFLqVSYJ42jGsY5FcV3gG1LmCSNJL8NiE4/m+8eATDX3qiHqxgyCBQzeWMqvVCQb3Tgkc64 zZr/M/B3Mm6OOWY44J9xuWRpFtwfzkLYW9/PrWY3irT8aQH53g7zjHBTyfCJJsC7WnXEc9Kr9If Slskv6mIsQJIn9PcI0UyrEL/OzaGk9iI1p3AA8znwd7rtGhsNRkgJJu0yXP/rg8GOtr+ARWWlQF +XU3gPbnYiloAiCpNvJwIUNyN6jzlJNznNiHqCD6I5t9zwTZMP4PwvZtjy9vmdsWBQV+6jFvomC jXKz6IQ3LYzuBWvQ9lbO4lyr9emytnxgYDyhK8p9PLKo6huFaFl2+mVxsWivwoyMZ4z/r/oHvQ9 h6fT2e+7VEjf98j8ACPUvgNdqa/rN5YZICVItnn1w== X-Received: by 2002:a05:620a:701b:b0:912:1206:ddd1 with SMTP id af79cd13be357-915a9c758d4mr1494790885a.1.1780773274164; Sat, 06 Jun 2026 12:14:34 -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-9158a00a4f4sm1311699285a.3.2026.06.06.12.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2026 12:14:33 -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 v2 3/4] tipc: prevent snt_unacked underflow on CONN_ACK Date: Sat, 6 Jun 2026 15:14:12 -0400 Message-ID: <63f37dc57a6d2cc614cc466582cd8d69192c720c.1780766454.git.michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: 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. 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") Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Michael Bommarito --- v2: - Validate msg_conn_ack() at the beginning of the CONN_ACK block and drop invalid messages instead of capping the peer-supplied value. net/tipc/socket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 9329919fb07f0..80ad973cda16e 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1362,9 +1362,14 @@ 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); + + if (conn_ack > tsk->snt_unacked) + goto exit; + was_cong = tsk_conn_cong(tsk); tipc_sk_push_backlog(tsk, msg_nagle_ack(hdr)); - tsk->snt_unacked -= msg_conn_ack(hdr); + 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