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

From: Hangbin Liu

Date: Thu Oct 22 2026 - 21:56:53 EST


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@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Xia Yan <yana06070@xxxxxxx>
> ---
>
> 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@xxxxxxx/
>
> 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@xxxxxxxxxx>