All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: Xia Yan <yana06070@163.com>, netdev@vger.kernel.org
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
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	[thread overview]
Message-ID: <9d592d49-ebc8-4a3d-af1d-6cb688d2065d@linux.dev> (raw)
In-Reply-To: <20261029024259.3700-1-yana06070@163.com>


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
>

      parent reply	other threads:[~2026-10-30  3:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  2:42 [PATCH net v5 1/2] veth: keep carrier off when resizing channels with a down peer Xia Yan
2026-10-29  2:42 ` [PATCH net v5 2/2] selftests: net: check veth carrier after changing channel counts Xia Yan
2026-10-30  3:26 ` Jiayuan Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9d592d49-ebc8-4a3d-af1d-6cb688d2065d@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hangbin.liu@linux.dev \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yana06070@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.