From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B46672D7393; Tue, 17 Mar 2026 17:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773767809; cv=none; b=boAmM9eLAc835ZSvvn+jcXo2dHFApG/s3XEeLskuYU+cRBLRfcff1X+M7pvluX8RRjZ3pziQsCjqr9mLopQ6Oej3noZdtd1Ch8SD7rCAIME5ABsqP5EozrVYKvs9PDXca4ENQ+ohI3La8hnKaMWxzPxnOLhVzu76vOM2zosvp3Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773767809; c=relaxed/simple; bh=GIkIaGTQQy0h6Y4mxJgyfZsIlY/qHc8SjAAZl2FJkZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A9Bj1HdXlPwzLMwm/0Kd2El0BQrwy01XqKhWk2hlrbXL3yaPKQKOe7LYXOtgBUGXzmlPyzcRSwKEFvSHsBYq8DAEO17HaWVY5PUNZYy7XeAy1wZrxHjdMH6pZmzpGgd5Bbh0QadmrnnvjxVs0OYcO2AOVB77XEGj6jlB1gvjYKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zo1OZLn0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zo1OZLn0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E48E5C4CEF7; Tue, 17 Mar 2026 17:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773767809; bh=GIkIaGTQQy0h6Y4mxJgyfZsIlY/qHc8SjAAZl2FJkZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zo1OZLn0xRp9pbcAxsjR7UhnRs/EbuknopQVA9P76HAoS9gNTmX0vMiBP6PFEhZY8 jSjEitTuBrIgQtmnk3lvbDzBmlR/rnx0w/uRkpTx/VlNsx47lKLEJfVQqQIwxgLBEs +5ogvGWdFU35qFSqS7bUd5zTXYjzzbE38YNpWJZM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mehul Rao , Tung Nguyen , Jakub Kicinski Subject: [PATCH 6.18 162/333] tipc: fix divide-by-zero in tipc_sk_filter_connect() Date: Tue, 17 Mar 2026 17:33:11 +0100 Message-ID: <20260317163005.368610504@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260317162959.345812316@linuxfoundation.org> References: <20260317162959.345812316@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mehul Rao commit 6c5a9baa15de240e747263aba435a0951da8d8d2 upstream. A user can set conn_timeout to any value via setsockopt(TIPC_CONN_TIMEOUT), including values less than 4. When a SYN is rejected with TIPC_ERR_OVERLOAD and the retry path in tipc_sk_filter_connect() executes: delay %= (tsk->conn_timeout / 4); If conn_timeout is in the range [0, 3], the integer division yields 0, and the modulo operation triggers a divide-by-zero exception, causing a kernel oops/panic. Fix this by clamping conn_timeout to a minimum of 4 at the point of use in tipc_sk_filter_connect(). Oops: divide error: 0000 [#1] SMP KASAN NOPTI CPU: 0 UID: 0 PID: 119 Comm: poc-F144 Not tainted 7.0.0-rc2+ RIP: 0010:tipc_sk_filter_rcv (net/tipc/socket.c:2236 net/tipc/socket.c:2362) Call Trace: tipc_sk_backlog_rcv (include/linux/instrumented.h:82 include/linux/atomic/atomic-instrumented.h:32 include/net/sock.h:2357 net/tipc/socket.c:2406) __release_sock (include/net/sock.h:1185 net/core/sock.c:3213) release_sock (net/core/sock.c:3797) tipc_connect (net/tipc/socket.c:2570) __sys_connect (include/linux/file.h:62 include/linux/file.h:83 net/socket.c:2098) Fixes: 6787927475e5 ("tipc: buffer overflow handling in listener socket") Cc: stable@vger.kernel.org Signed-off-by: Mehul Rao Reviewed-by: Tung Nguyen Link: https://patch.msgid.link/20260310170730.28841-1-mehulrao@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/tipc/socket.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -2233,6 +2233,8 @@ static bool tipc_sk_filter_connect(struc if (skb_queue_empty(&sk->sk_write_queue)) break; get_random_bytes(&delay, 2); + if (tsk->conn_timeout < 4) + tsk->conn_timeout = 4; delay %= (tsk->conn_timeout / 4); delay = msecs_to_jiffies(delay + 100); sk_reset_timer(sk, &sk->sk_timer, jiffies + delay);