🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6337

[PATCH net v3 1/2] veth: keep carrier off when resizing channels with a down peer

#6337
From: Xia Yan
Date: Thu, 22 Oct 2026 08:58
75 lines
11020 bytes
veth_set_channels() temporarily turns carrier off while reconfiguring a
running interface. It then turns carrier on for both ends without
checking whether the peer is administratively up. If only one end is up,
changing its channel counts therefore reports LOWER_UP even though the
peer remains down.

For example, after creating a pair with two RX and TX queues per end:

  ip link set vca up
  ethtool -L vca rx 1 tx 1

vca incorrectly reports LOWER_UP while vcb is still down.

Only restore carrier when the peer has IFF_UP, matching veth_open().
The local interface is already known to be running at this point.

Found during LLM-assisted source review and reproduced with a veth pair
in network namespaces, without kernel instrumentation or error injection.
With the complete default veth.sh on x86_64 QEMU/KVM (three vCPUs), the
four mixed up/down cases fail before the fix and all six carrier cases
pass after it. All 55 existing checks pass on both kernels.

Fixes: 4752eeb3d891 ("veth: implement support for set_channel ethtool op")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Xia Yan <yana06070@163.com>
---

Notes:
    Changes in v3:
    - Driver code is unchanged from v2.
    - The companion selftest is now part of veth.sh.

    v2: https://lore.kernel.org/netdev/20261020135544.24441-1-yana06070@163.com/

    Testing on the v2 baseline 513444cc62e2:
    - Complete default veth.sh on x86_64 QEMU/KVM, three vCPUs:
      before: 57 checks pass, four mixed up/down carrier checks fail;
      after: all 61 checks pass. The 55 existing checks pass on both.
    - bash -n and git diff --check pass.
    - If creating the veth pair fails, the case is skipped without
      masking failures from earlier test cases.

    Both patches also apply to net/main ffdf678dd166
    (application check only, checked on 2026-10-22).

    The QEMU guests failed to power off cleanly (initramfs issue) after
    the tests completed; the exit codes above are the veth.sh results.


 drivers/net/veth.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 643b97d..4e75830 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1372,9 +1372,10 @@ static int veth_set_channels(struct net_device *dev,
 		 * to identify the range we have to disable
 		 */
 		veth_disable_range_safe(dev, new_rx_count, old_rx_count);
-		netif_carrier_on(dev);
-		if (peer)
+		if (peer && (peer->flags & IFF_UP)) {
+			netif_carrier_on(dev);
 			netif_carrier_on(peer);
+		}
 	}
 
 	/* update XDP supported features */

base-commit: 513444cc62e231a11c9b15ea88de0890da9b2b4f
-- 
2.43.0
Technical Details
Message-ID: <20261022085842.2527-1-yana06070@163.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350441-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-350441-linux-kernel-netdev=dewy.ru
From: yana06070@163.com (Xia Yan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 1/2] veth: keep carrier off when resizing channels with a down peer
Date: Thu, 22 Oct 2026 16:58:41 +0800
Organization: Usenet Network
Message-ID: <20261022085842.2527-1-yana06070@163.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="169762"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:kaQr6r0xzPMOcu8/jSs8xLYZZag= sha256:WLVb4/MchkOlKp8G/tb/K1jCmOPz/s4ng1BZACxY7Jk=
	sha1:RsTcL0LTrkdbQJOq31ZDb4C3SSo= sha256:HXlzvlcbLXk0tMoAUToY94qNLr4Emd9IOvqBPk9SdoA=
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 C3F061111BD; Thu, 22 Oct 2026 12:04:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.047
X-Spam-Status: No, score=-3.047 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=163.com
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 3ZI2Pc31f9YY;
	Thu, 22 Oct 2026 12:04:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350441-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=163.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A08041111EA; Thu, 22 Oct 2026 12:04:33 +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 AFE4437DD4; Thu, 22 Oct 2026 08:59:34 +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=1792659574;
	b=WSAMPG3fhXSuJCGGZq++RhQgPgY21fZvbBN/lBKYlVHM2d/RZM8MjOjESKLL95j7fdRe
	 95khNCRRjUlhseqMQfzbLCQI0RlzmSH4BnbrZwSI/JlPXse74tSBwNz0J6IHhtYRZDPGX
	 I0E1CxqdloGaO9D0VbhKlQNKT69acjzfRQq6QpUUHteOuqpi28GuErQCZxt7anr1aeZaO
	 84rNdE1xGJbpWi1kn6bWUz9cutMo/alZrl6d596FM3J0uFTsUIdVgYMYY1D4YVDrWObOS
	 Cv5sBWn8dC1rnnsAs8zIH6vqM0cHduXVFb2Q0AxdmtNF2jHjEr+Q3Zvpra7jwhOlEbg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792659574;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received: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:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=ZMk/Z/bZy+BI5/W0PT4Wtme0XLTO5nzW8fyutMCfad0=;
	b=N2BkbSCoik2pV44w6vWFSDbiQLzrS1Ux1iXXb+PWYOiA55spZBE5Xp9N8VK252EGuNSA
	 eJVYfRnN1O7HukL7uVAV0Fh0AoI/rhfu8tmjmCwisMfyfoWD/BWk3xacm2XbR14/QM5BH
	 p+oahwq7Vf4ukOY+QSLpUSOJuo8biQickGARBs/rJEDuXTptk+Ks9wGxV6DvuzZFTDoXH
	 UFyHNYtxgRaHT+IBUDy/vGyJQbKgrn/P7qhoMZHOjivedG2xauTZcr26jeWL/W027Aeal
	 G+74dqN4NrntY6eswOrYErJWWo4lv9YFfr5FpjAPwWJmVFZrp+rGOzpaYpXeLHLaz+g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=byvtiKI8;
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.com;
	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 51139606A31F;
	Thu, 22 Oct 2026 08:59:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=byvtiKI8
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.4
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792659563;
	b=YGSrxwCIt2qWzS3vQyly66uadTqM90KqUpSQHWr5ok8UlSLWb+7fmQRUL+9YLrBxAI3y
	 2d3ULk/+X4D+MEW2eSIS6fYBsRH9vDprTfIPeJs5gDGEOjVGvXmHJsmhsx9RPTsq8HTaE
	 +bBhNoKYXBb2L0rnGebmfy9jVYwfpG2RVz1fFQoqGOYYARY9yvPzWvLo4SlEwo77YTHds
	 xDVuSjWbXUfvenGnsEqZ9/bdczYLHjUGfwj/g1j4C5HvMFi6tNvxPnYlNFnmoicsLfc1t
	 x/V0V2uEABaLvmtKHbG4ZkKksM1qJexdK17AbK2LogKqIJUKzKn73AfJKW1Ibl1F/gw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792659563;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo;
	bh=ZMk/Z/bZy+BI5/W0PT4Wtme0XLTO5nzW8fyutMCfad0=;
	b=KWe+db5XBmZwPuVupSZ7/rddfQApnjgOS7vZiwnm8kE0mse/daX81vbSL9nIcA1MiNWz
	 y5CM1hEpvrfYc96mPFt8i8vfZp0T4flgpOC798WHAhEKF/pEJujOs6XaFH+/0njkLX+ur
	 xWsqrQjoV/eg8U3NRiLSr0AcSBOj+bjjzpwv6mSy4SpstgG2Wm5Bm129o09A7r41cAqgI
	 5nzuGueKseVRuTrmesU6wMcT86SmkOZTNQk3XwkvLpWze+FN17d3m0+mgG69sZH4bklK8
	 6HtqNtQTrwnjKO0PHlQEa2fCuRiiQU+drJJNu73JzTy7xSw7/yhEQeiIjrmJvwnU0dg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.com;
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=byvtiKI8;
	arc=none smtp.remote-ip=220.197.31.4
X-Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AE94606A323;
	Thu, 22 Oct 2026 08:59:21 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9AE94606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
	s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=ZM
	k/Z/bZy+BI5/W0PT4Wtme0XLTO5nzW8fyutMCfad0=; b=byvtiKI84ZxBHjW6xy
	O1HfJlWVoORKY+VFxflWs+iUz2axoL7Dfg5tRMfUV77DK1XCpNWuOJ+LdEB4rJyP
	aflyoNjmtSisC5l7x3XlX41VXAtNV7gnN2uiu7BPzgP48bXixOS7XWVXLOyF6Ju+
	zSxDHoUFvJaEu7BlXZ+hgvbT8=
X-Received: from localhost.localdomain (unknown [])
	by gzsmtp2 (Coremail) with SMTP id PSgvCgB3lRxP0NlqnOotBQ--.27898S2;
	Thu, 22 Oct 2026 16:58:56 +0800 (CST)
X-Cc: andrew+netdev@lunn.ch,
	davem@davemloft.net,
	edumazet@kernel.org,
	horms@kernel.org,
	kuba@kernel.org,
	linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	pabeni@redhat.com,
	shuah@kernel.org,
	yana06070@163.com,
	stable@vger.kernel.org
X-Mailer: git-send-email 2.33.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
X-CM-TRANSID: PSgvCgB3lRxP0NlqnOotBQ--.27898S2
X-Coremail-Antispam: 1Uf129KBjvJXoWxXF4ktF4kGr17ur1rGw43GFg_yoW5GFyxpF
	4fJay5uryxXF1jyw4vg3yUCryUta1xJ3y5WF95K3yFvwn8JFs8XrWFyayj9F1UKFnYqFW2
	vrZ09rnrZ34DZaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pilfO7UUUUU=
X-CM-SenderInfo: p1dqtiawqxiqqrwthudrp/xtbC3xFZ32rZ0FHBogAA3Z