🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6646

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

#6646
From: Hangbin Liu
Date: Fri, 23 Oct 2026 01:56
81 lines
11246 bytes
On Thu, Oct 22, 2026 at 04:58:41PM +0800, Xia Yan wrote:
> 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
> 

This one looks good to me. I can reproduce the report issue.

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Technical Details
Message-ID: <atq-0HbV71AcQi5t@fedora>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350872-linux-kernel-netdev=dewy.ru
References: <20261022085842.2527-1-yana06070@163.com>

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-350872-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 1/2] veth: keep carrier off when resizing channels
 with a down peer
Date: Fri, 23 Oct 2026 09:56:32 +0800
Organization: Usenet Network
Message-ID: <atq-0HbV71AcQi5t@fedora>
References: <20261022085842.2527-1-yana06070@163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="387647"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zsigCWRle+6sFRO22Y0+X6+SFNo= sha256:pXtaT4DCdmA3u2tQ+37FHvDLMCzP17xbbhvMH7lRYL0=
	sha1:59J0Kin9NqgO3M8HaFpn1EYG23s= sha256:SVitT3bmMh0moZleRooVUbAKmm2R5Ji1A9he8aC9YtM=
Content-Disposition: inline
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 88B781113B4; Fri, 23 Oct 2026 05:00:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=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 C6RjujjpA5SY;
	Fri, 23 Oct 2026 05:00:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350872-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 D35AF110E3A; Fri, 23 Oct 2026 05:00:35 +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 1798D36F80; Fri, 23 Oct 2026 01:56:48 +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=1792720608;
	b=JL5BG7SOVsusMSlwk1lUp9GKn3r1HuyC5+WcVzXN40KZfK/8aFBBv5kfWDnmpXZ6q2rN
	 ptdwEVDRzw0ESMgEzOCBLZY2PIHUFpHz0D1AZ/DfGSNge5Wysi+EZrGnkpKzGymUPVGQc
	 W8e0yNpytln95jCObY+9AyGOyMYDBGlJVQND/F4tZHodLX60Kd+d8JTwq0YNVywdkCKW3
	 4NxYnIc+RGJh8/mzeFEzI1phxHo+e8sGeYeVp+duzW6paT796gOiUBXEAFkoGoPa7UpH2
	 g7aFpxw4O4BOMg2fqeZHUpIBSHU5Jrru/HNt7FQpG+xUQe//d7Q2bGwF+rWO3oLNzSw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792720608;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=oJFZy9ViA1hdkCiyEzcB0JcdRGfXjVzuA0WGwLAmCs4=;
	b=2Gp2RleyaBWIZcf5FfLh6XAk2MzcqfS2T1X48/emcc4WeQT+Ge7glEiuenIr7vv3O2wv
	 XmRAw+EleCmcy3H4JnWaqgY6ZlNLZu04Udk/aj9ad9c9EjpjdgVlHKItgxCuXj/STJwOO
	 NF9HcdbQAFI5FhlMqzvAsyBBmPOFDe7RNsM6pIGpiatDqOVJs9LsB7OCV52oEgSly6Nq9
	 AuaUyKeYCHqWMp7xAtCxvZEveJ2UplCtrt1JzMkCRbTG0CF78BE0OjuX6AOV9Qnk8xQuh
	 v9sYkh3vGws0S7rk7J5BJ/aG+eZarZk/rdVnjth4WCrr2HH68T4iZffVkBu1ZR8C80A==
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=lFDEReVK;
	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 E40E9606A32C;
	Fri, 23 Oct 2026 01:56:47 +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=lFDEReVK
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=1792720607;
	b=TOM+se+cYtncmGxdlhE3OFpA0qBDMHC30RfpZsFEBjA1sLkPkdEOks6DlcBC5TsOgxiR
	 L7uZMJt6ydvXK0YeJBYRUtRSXGFFyfQOsSHN4zlr1Y2hymLBoarPti7VfCq9R9nCXgGMS
	 0S2/tdSksnuJ6FzI3yHEuCQHXIV8L+wzvBlsGgCdCPU+S2nmW42bFxfdduFmn0ZuQBGF3
	 gE35Najka4Gka3zPx4c/DMjLesvpzxf7tuUvahkj+A8YzucKW7OdVAaA5EtaA7L6s+Vsd
	 wnmcJfqs0yq5C8P8jhIp4S4vr23I2rhnmwtxHqVLg0sFVkgAqLf1KhpjNPwPUUH8QYg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792720607;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=oJFZy9ViA1hdkCiyEzcB0JcdRGfXjVzuA0WGwLAmCs4=;
	b=3Tbv6NvZHefNekGQ1MOn5oAiwQYTPsRGW/PAQ1cCPo06CNeCNZgBScppRRMcMLeGQoUC
	 NcAQP0b17ZGzODbBNwBUPPtA8285FrDrsSe7SbNErSklaN/PFNCarFbzx/rZRP6w1NmGA
	 /uJm1x4LSFHrxibXWx77JUYJC5k3vk/YMamj91kAMsza5r2skDVwcTqvOYk68B632cyyI
	 Ppz35Tf3T0Uw5Hs8RqmCf0a/ghbELC1rFWKp00Oo683fFC13aY/zfZudNzdUb7V0btsZK
	 tEueBUCFOwF27ahWhO/+aNRgNewkK7TGDZuC/GhnMa2/yyViQ6VZyfInhExrFQG6WZg==
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=lFDEReVK;
	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 90358606A31F
	for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 01:56:45 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 90358606A31F
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=uX9E3o73V748llMETRdDfpWjDG+k2zeZTW03xJwVkb0=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1792720603; v=1; x=1793325403;
 b=lFDEReVKixlCCV8aln0VUOKnuYSlp8pGFtrke7nXPTicTCunZ0H8IlsIY4l4xMkG6xCOdQub
 qnGxz1sHC4r301LLvNBrT/Au2ztMkB7/IAGCmIC3V7Ws1h61Pjg4urSiVsPv8Lf/Z/reEb56Vtk
 q48DpLvM5j1fEAqr7eg9wOq4=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta12.migadu.com with ESMTPS id 1f1f20d373d9e1ae;
	Fri, 23 Oct 2026 01:56:43 +0000
X-Mizu-Trace-ID: 1f1f20d373d9e1ae
X-Migadu-Flow: FLOW_OUT
X-Cc: netdev@vger.kernel.org, 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, stable@vger.kernel.org
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-In-Reply-To: <20261022085842.2527-1-yana06070@163.com>