🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8756

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

#8756
From: Jiayuan Chen
Date: Fri, 30 Oct 2026 03:26
84 lines
11426 bytes
On 10/29/26 10:42 AM, 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.
> The companion veth.sh test reproduces the two mixed up/down failures
> before the fix and passes after it.
>
> Fixes: 4752eeb3d891 ("veth: implement support for set_channel ethtool op")
> Cc: stable@vger.kernel.org
> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
> Assisted-by: LLM
> Signed-off-by: Xia Yan <yana06070@163.com>



Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>


Thanks, I clearly remember it has been reported somewhere...

> ---
> Changes in v5:
> - Driver code is unchanged.
> - The companion test drops unnecessary quotes around literal up
>    and carries Hangbin's review and test tags.
>
> v4: https://lore.kernel.org/netdev/20261024093007.12981-1-yana06070@163.com/
>
> Changes in v4:
> - Driver code is unchanged. Add Hangbin's Reviewed-by.
> - The companion test drops the extra GRO on/off runs, as discussed
>    with Hangbin, and keeps up/up and both mixed up/down states.
>
> v3: https://lore.kernel.org/netdev/20261022085842.2527-1-yana06070@163.com/
>
> Runtime testing of v4 on 513444cc62e2, x86_64 QEMU/KVM with three vCPUs:
> - Complete default veth.sh:
>    before: 56 checks pass, two mixed up/down carrier checks fail;
>    after: all 58 checks pass. The 55 existing checks pass on both.
> - Script exit status: 1 before, 0 after. No checks were skipped.
> - Both guests powered down normally.
> - The runtime results above are from v4. The only v5 script change
>    removes quotes around a literal argument.
>
>   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 643b97dc52456df80de10068ccac9af2ada70256..4e75830061ccd3def0476b19a2f92e818464fce9 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -1372,9 +1372,10 @@ out:
>   		 * 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
>
Technical Details
Message-ID: <9d592d49-ebc8-4a3d-af1d-6cb688d2065d@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-353549-linux-kernel-netdev=dewy.ru
References: <20261029024259.3700-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-353549-linux-kernel-netdev=dewy.ru
From: jiayuan.chen@linux.dev (Jiayuan Chen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 1/2] veth: keep carrier off when resizing channels
 with a down peer
Date: Fri, 30 Oct 2026 11:26:40 +0800
Organization: Usenet Network
Message-ID: <9d592d49-ebc8-4a3d-af1d-6cb688d2065d@linux.dev>
References: <20261029024259.3700-1-yana06070@163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2153904"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gdf+1tN736rCkFtR5p+bOpkA7W8= sha256:/Snfh0MMZvfBWoWPSeqWA3gz35jLWkD+ZAZui1dpB/c=
	sha1:FUwaxNtawn+8tzP5C4P4dpcl+ac= sha256:3vlnG32/Q8SWe6Cg4wXD9HK7GF51BwxeUbOMvESEnj0=
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 49428125C7E; Fri, 30 Oct 2026 06:27:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.05
X-Spam-Status: No, score=-2.05 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, 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 PgAJvP1NjzFN;
	Fri, 30 Oct 2026 06:27:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353549-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 D6329125C7C; Fri, 30 Oct 2026 06:27:30 +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 70B7929BF0; Fri, 30 Oct 2026 03:26:58 +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=1793330818;
	b=BBAVIKNJm0gq4TMiSdVXDrFXvD/JnD7iRvb8aF/SB5XWFuLIAie9af2N0XH35W9YtdPQ
	 hQqLZFkhZWxSFB2CVMaE6XSEb/yLwPN8dvy2UC1oN6+ydOeSiTHXHgqkqipXIr7VRBCQo
	 SqUYlky4supA829ChmWy4QjDQb/kxloArPDGbd8w8h8NhcJxp9m8TzGk8kT6JvjLYmmmE
	 P8yiMyvmsWNvjrjuhmZZl4rnALFfAY10W2o3g9r4uglkjN1cS7ZB/PNLvZPo7F8jEds3V
	 ByYBYJG/jgK/VwLA0UMDL3OB6voDu30GbzO2+Xpk6l9eTWeDgSuuhqpQh//+LipBvSA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793330818;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:To:Cc:References:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=gNgrq0owYBabIu+cyKFWAz7J9oi+IwK3EkpuRpgRVL0=;
	b=RO4d78WrLBN5zvpLpxqA99icXGgzl52pWLuA5G7blLzKSwFqxnaibJ0epnkmvVgRI1Cv
	 Wk25q3driEJEUAhQbBxD+3mN2XkJuATrmbyKFuxWxg9c2/073k/r0zfYYoVqbCT+g1X7Y
	 QowWshvPZJblYEb74P9y299YIM2HNc5v1OhvXQo5UyBrrVG9KEZ0mEsHsrbwLGO3MwHC7
	 l8am5t8kCs7domNjvwwEsGmV6/nST3jwjI+YEtTZTXIX1bSF3TSlJBypvAR6D/oV/FY8E
	 DzDXfgu4U4fB5LpZaJMmfopYPJBjOMWh2EPQl34tXxO0VKaaoIHCZk55ocWoUNiWrjw==
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=Ff5he46p;
	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 48362606A321;
	Fri, 30 Oct 2026 03:26:58 +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=Ff5he46p
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.223
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793330812;
	b=G2Ds++aMZtQITXPufGWCw9wgMowAqpjhKIJQUKoFMmG2KoOePhQx5ZvA7ixH9SrowKTk
	 nQM6ZBuml9STCOd+W0N3OyWyFJ7vqcj/JztAipOERMAfxOv7snedrdjlnP5NGdlF9gUtG
	 Legi7VmqfhhmdYjok/6R/RN8BAfeVNwoeq+55LfuiWx+lr3IKNYf97uy77LCbC1as4wxe
	 yqG07fE7vRrDfU6ZW/ToFeIZWN2UBKoeTyAmsyNsl/yNkBTVSOSdZ9Z8dfi8NaoZuQK1t
	 8btjwft2B1DOhxeplPir4JNJZqQldZJbpkPdUnr1rDjm/X+ttzzwFBbrcsa3tt50Xhw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793330812;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:To:Cc:References:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=gNgrq0owYBabIu+cyKFWAz7J9oi+IwK3EkpuRpgRVL0=;
	b=DWy5Nju0660Rmo8IQqbNOTKWUu7MtqrAnSXKwrwT3DD/9UB85lbEHKbASa1OExlzslWx
	 Afykvytfw3BQ08p8eetRrcWeR3So/T/0STn77nmiuHpxliTG8G4QLQAxzRqELnKARs7Kk
	 3OM73jX6HM29F8ZtE8njIoAXq4eXQ//UUTNf17zuB3yrAabtgYU654VuWitquunIDKZAU
	 Zw81dOxvlh0rCh2k9Gu3vj2YJwpU7Lr1T0oqUePfRI4db1kD5RUHfTcPUvOczJFoJpOcB
	 OS7lQwr/csI2mIh8Tge4o/aNzy2oLDb9BRwwVNooqVUAdZgptyfpNs9+ttQifzI/2vQ==
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=Ff5he46p;
	arc=none smtp.remote-ip=95.215.58.223
X-Received: from mta1.migadu.com (out-223.mta1.migadu.com [95.215.58.223])
	(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 93FA3606A31C
	for <netdev@vger.kernel.org>; Fri, 30 Oct 2026 03:26:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 93FA3606A31C
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=P4sVG6gAsKMk1pWV0klicmych+OKQW4cm/nQyosN14Y=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1793330809; v=1; x=1793935609;
 b=Ff5he46pDGf+pB2O3fS0/jXrpWZXVWnKu18xIxaG0+jhTChfs8Q1kJwqq2ZcxnGf1Z9dNf2J
 BAZH4mKir2E42QKTC2lpY1wqN4GQh+fWp+/Qczt6IENBy9kGptvz9C7H7gXexbF3i1oeazubadL
 +LVQNWcgIbmO5AeYc035JYmE=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 3cf042a3802d9ad0;
	Fri, 30 Oct 2026 03:26:49 +0000
X-Mizu-Trace-ID: 3cf042a3802d9ad0
X-Migadu-Flow: FLOW_OUT
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-User-Agent: Mozilla Thunderbird
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,
 hangbin.liu@linux.dev, stable@vger.kernel.org
X-In-Reply-To: <20261029024259.3700-1-yana06070@163.com>