🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6772

[PATCH net] bonding: fix out-of-bounds read of arp_ip_target

#6772
From: Jiayuan Chen
Date: Fri, 23 Oct 2026 10:45
53 lines
10105 bytes
arp_ip_target is a module parameter array with BOND_MAX_ARP_TARGETS
entries. In the loop parsing it in bond_check_params(), arp_ip_count is
the number of accepted targets, while i is the index into
arp_ip_target. Invalid and duplicate entries are skipped without
bumping arp_ip_count, so bounding the loop with arp_ip_count lets i run
past the end of arp_ip_target, e.g. 16 targets with one duplicate:

  BUG: KASAN: global-out-of-bounds in bond_check_params.constprop.0+0x1148/0x1440
  Read of size 8 at addr ffffffff96e9ee00 by task swapper/0/1
  Call Trace:
   <TASK>
   dump_stack_lvl+0x91/0xf0
   print_report+0xd1/0x630
   kasan_report+0xf3/0x130
   __asan_report_load8_noabort+0x14/0x30
   bond_check_params.constprop.0+0x1148/0x1440
   bonding_init+0x13/0xe0
   do_one_initcall+0xe7/0x5b0
   kernel_init_freeable+0xa91/0x1120
   kernel_init+0x24/0x220
   ret_from_fork+0x5b3/0x820
   ret_from_fork_asm+0x1a/0x30
   </TASK>

  The buggy address belongs to the variable:
   arp_ip_target+0x80/0xa0

Bound the loop with i instead. arp_ip_count never exceeds i, so it
stays within BOND_MAX_ARP_TARGETS too.

Fixes: 5a5c5fd48e3b ("bonding: arp_ip_count and arp_targets can be wrong")
Cc: stable@vger.kernel.org
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
---
 drivers/net/bonding/bond_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 09aa45d71fab..7019e5d8fdc8 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -6273,7 +6273,7 @@ static int __init bond_check_params(struct bond_params *params)
 	}
 
 	for (arp_ip_count = 0, i = 0;
-	     (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
+	     (i < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
 		__be32 ip;
 
 		/* not a complete check, but good enough to catch mistakes */
-- 
2.43.0
Technical Details
Message-ID: <20261023104528.232427-1-jiayuan.chen@linux.dev>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351018-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351018-linux-kernel-netdev=dewy.ru
From: jiayuan.chen@linux.dev (Jiayuan Chen)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] bonding: fix out-of-bounds read of arp_ip_target
Date: Fri, 23 Oct 2026 18:45:27 +0800
Organization: Usenet Network
Message-ID: <20261023104528.232427-1-jiayuan.chen@linux.dev>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="478545"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:I0yxlEOvcjOzHAXb3vdMc3IpPM4= sha256:9+K2V3IUUEM5vAPaTcrRj7HwSz6DMF8JS/5UFpw6SXs=
	sha1:va08m368/wgDcE22g8Q58JtvWS8= sha256:GhgeXHCZQakf49jv9wBFlWGi8jaWMx0y6yLHzPqwrPA=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id ED0C311146B; Fri, 23 Oct 2026 13:48:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.051
X-Spam-Status: No, score=-2.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	HK_RANDOM_FROM=0.999, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id HZV7PLyzV4OZ;
	Fri, 23 Oct 2026 13:48:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351018-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 4C10C111467; Fri, 23 Oct 2026 13:48:42 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 26832384EA; Fri, 23 Oct 2026 10:45:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792752356;
	b=vQ/mBmB88z5r5zmzzeaoaXCXByBPh/DVSHrn9HYtqr0pxBziZB5qxP5TpWss3JGuPLbc
	 Vsi6SIMrJq933KNSsbVL7G+fbotR6dK9k28SXqed2jnhIlaUMwrzFVnBp5R0KBIB9S895
	 +AmCJQb3C695FBBGisoXSAufAlJ+GP3v9Wyf2AdtqjxO81vJPuxJHz1pDEJYkCGnpu0Fb
	 sQ4bX4d9qSMgmYJldIJgVM0JvwBVGukjXAi78qKFglKZQvJaTJuRkkuEndjRN0hZ1HORk
	 65zm8NRjZhGXpjtpoEMQVsheQ5FBUWKChgfx+hqvmr2F3lP0GlKx1wVQrEHdwLvdAiw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792752356;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:
	 Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding;
	bh=/QICUucPpXxojYxCmq3sRU8Eaip6NUcM3x+3QrmGv+8=;
	b=fw00s84QalnMF8kE2sD86oKcHnbpoeZPYFlwfsgGSg7HnMV4/KsESgAvP0yMZStfdF/f
	 Mxmemp5ly+e9fii91nt0GTZVyHjqLWY67rtL3EfU2QB/3oAw/G/0thkJugLUzJ4eF0/LI
	 iU7N8dQD0+6rMuJBpSjSF9s87VOFYzBhoHodZH2mRwmux5CZ4SE4SXw6lCGJvAG6g8yxd
	 aR4y7UpAWKfg/B84w/1kVl9Rc/E1qVmcBOiYjUxvoisCaJNN6uuwmZnSZ+il5mRpFsvPg
	 UAI/E8JggeUpGEt1GwJawo1+V3iQYERuNPUk5nWqAOPZOTMDmcNOfcnQSwORwwE+iKw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=m7oOr6su;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id F2093606A324;
	Fri, 23 Oct 2026 10:45:55 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=m7oOr6su
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.173
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792752354;
	b=H8gMz22MMZi7Fy9idy9YlQLX4tmYif74Jxl1fE0jcjDIuX3mK99ydbvgUJX1LY3aN/w5
	 XTCIGs6dGHaGsLCICfUfg9suHujZ0yJpWY52lrPy7U7X6SPyVI2nYdvMQS9eIR2XikwPt
	 /kETR2e0h801v2iF+ipjeAKsg5O6oL/gqz4C2lNBc7eOSRsFXa+ysPSPPo6LHRNatp9Jn
	 Fk8uXx+iLYYnjBrTtkTICWwyuqjr6HWYUtzGzHe3CmM25sCrW1KALCcPFUrGm5az9Iude
	 bDjCxKMl+xLz5x2pMH3RmNHpEEJXuz2eXe+GVGtsd0hTQxEO4xM5pQ6xseh/4kS5e/A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792752354;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:MIME-Version:Content-Transfer-Encoding;
	bh=/QICUucPpXxojYxCmq3sRU8Eaip6NUcM3x+3QrmGv+8=;
	b=joQXM6S7hFSZ1x8knmD70l6oCAe8mXIQrIW1cyfclg3K1RrzdILBu/Mn3ymcsl/HHN8W
	 rrCC1rlQbuHs5DlNGDkuADxiGCZqEI/hn1edmBQZBD38Lds+D/mHN5Kosi+Yr4AKFQ/wC
	 CtoY9Yand2V4pFT7YArpYUgWgzCZGf3y1eko7bXvfjdEUtPVEhdytQxtu+e2mKKfVZc6l
	 zIug1X741WDNvapdTmTr+RkWF/z3jB/PODFDAJwKcIZh7/ZFVmUD0Eg2IaxLA4K0Ed9tC
	 qmIivxngEJ60v3kV3ZZlxMSmtw2sQ/6Tm1cyVDZMpC27w3ubvZ/lGuCMklPyk/CejjQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=m7oOr6su;
	arc=none smtp.remote-ip=95.215.58.173
X-Received: from mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D25F606A31A
	for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 10:45:53 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7D25F606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=e0Cethm8EB8vXNdwt1eCOrxjlbHI4XfqJVujITYWMIw=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1792752351; v=1; x=1793357151;
 b=m7oOr6su+D3IRWZ+Nw1K5IVj2dKwCtI3MQG2UExgvDS5QXsBLJPkm8rMAgKChheqDtW7699d
 ZC0UF8msPReMirU8vU9UbEJUODZj2SeaqtPGcOMF58+McY+yKmVHHN6VExTNqDiw0uskvWhKvdk
 3QeQPXCaFMtyLl8M+ge1aDgQ=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 536d72eef6148e6b;
	Fri, 23 Oct 2026 10:45:38 +0000
X-Mizu-Trace-ID: 536d72eef6148e6b
X-Migadu-Flow: FLOW_OUT
X-Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
	stable@vger.kernel.org,
	Jay Vosburgh <jv@jvosburgh.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.43.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list