Article View: linux.kernel.netdev
Article #26203Re: [PATCH net v7 2/4] ice: do not leave switchdev mode while subfunction ports exist
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 08:01
Date: Thu, 03 Dec 2026 08:01
76 lines
11400 bytes
11400 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] When SF ports still exist, the new refusal in
ice_eswitch_mode_set() (drivers/net/ethernet/intel/ice/ice_eswitch.c)โฆ
--
ice: do not leave switchdev mode while subfunction ports exist
This patch makes ice_eswitch_mode_set() refuse a switch to legacy mode
while subfunction ports exist, by checking pf->dyn_ports. Without the
check, devlink core can let the change through when DCB is active and no
rate nodes are exported. The representor xarray is then destroyed under
a running switchdev session, which later leads to a use after free in
devlink_nl_port_fill().
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> index 6e7bba4738989..44ef1fcfc6e4a 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> @@ -356,6 +356,13 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
>
> switch (mode) {
> case DEVLINK_ESWITCH_MODE_LEGACY:
> + /* subfunction ports have representors too */
> + if (!xa_empty(&pf->dyn_ports)) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "Remove all subfunction ports before changing eswitch mode");
> + return -EOPNOTSUPP;
^^^^^^^^^^^
[Severity: Low]
Should this be -EBUSY rather than -EOPNOTSUPP? The condition is temporary
and goes away once the SF ports are deleted.
The same user sequence (eswitch switchdev, port add pcisf, eswitch legacy)
can also be refused one level up, in devlink_nl_eswitch_set_doit() in
net/devlink/dev.c. That check runs before the driver callback:
err = devlink_rates_check(devlink, devlink_rate_is_node,
info->extack);
if (err)
return err;
mode = nla_get_u16(info->attrs[DEVLINK_ATTR_ESWITCH_MODE]);
err = ops->eswitch_mode_set(devlink, mode, info->extack);
When rate nodes exist, devlink_rates_check() returns -EBUSY with "Rate
node(s) exists.".
ice only exports rate nodes when DCB and ADQ are off, because
ice_repr_set_tx_topology() returns early if ice_is_dcb_active(pf). As a
result, user space gets -EBUSY from devlink core with DCB off, and
-EOPNOTSUPP from the driver with DCB on, for the same operation.
-EOPNOTSUPP usually means the operation is not supported, not that it is
blocked until other objects are removed. Could tools that branch on the
errno treat a retryable condition as a missing feature?
The existing ice_has_vfs() check just above in the same function also
returns -EOPNOTSUPP for a similar temporary condition. So the patch
follows local driver style, and that mismatch with devlink core already
existed.
> + }
> +
> dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy",
> pf->hw.pf_id);
> xa_destroy(&pf->eswitch.reprs);
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202071642.2527605-1-poros%40redhat.com
Technical Details
Message-ID:
<179628491563.3146.9047666199900210939@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376386-linux-kernel-netdev=dewy.ruReferences:
<20261202071642.2527605-3-poros@redhat.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376386-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v7 2/4] ice: do not leave switchdev mode while subfunction ports exist Date: Thu, 03 Dec 2026 08:01:55 +0000 Organization: Usenet Network Message-ID: <179628491563.3146.9047666199900210939@kernel.org> References: <20261202071642.2527605-3-poros@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2431059"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mTSJPGpGkOmeCnZhDK1JF/iG2fg= sha256:EG4gCB5dhETJAHvnUArn5ROq+hfMObmsSGq1IlHbxCU= sha1:8JsQKPWziufeDx1gx/f4UtpjvbI= sha256:KrbbJyEIr/S/u1h5OHE5/864rXjkPgTF78SovEb9vHA= 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 861D1117870; Thu, 3 Dec 2026 11:02:24 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 1Y5nbVEDRR6h; Thu, 3 Dec 2026 11:02:21 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376386-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id BBA3C117877; Thu, 3 Dec 2026 11:02:07 +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 81C662A429; Thu, 3 Dec 2026 08:01: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=1796284918; b=SsL/z6vi3cGTipq2GL4133nDgfqJ3nrU6THgkXdBHT5E4oBxFOKEpjKWFs+r0bMbwvdr mWRx+N/cW2jg7biWwONrteCPpZsFGbLqp8DAoEk72NFcowNFPHZGeHtqmTKwsYpVc5th9 5UABuLoF8hA8vxeF8j9EtBiDCwvS/+Hz493JHpV2Mvu0jo/2mkUgZBts4Ryy92Ct/RAhr bnLDwlg/CETCUIO6ymMwCoMkdZXQ7a0VRR6AyGOCPTzLUO/+jgEZnoe01+JM38la9WeIg 0YogYHFIQx/v35e88piA0t7mwyWG/sGG40Wq9XE9r+R237z7Ak2X6HGErdsbGzbWxQg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796284918; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=uKLjXxGG5z8zM0Nk4vXsc1p9z+Ka//cmQJQ4A0UrP0s=; b=VDI2eIrHUqfjhJzAx8KDeY6zs3FpOaCPTP9F7hyNr8rTG9EOUV/Sd8SePyyzL+tiXad7 80GkuliT1LPbxgbRNF8ZNM3WhYg47e3pUeOz8iY+NIVWbfDG5RpkOJZ5efJMhzrXOtS7w D3UmyIOfsGDkYyD5l3BrN1AgU9l0xJjvaPJO/qoID/BvTEHJcoByB9vZJZ/L7R3KdkijI goNuYXzklOaBpS+Qfs0CksFeOslNFSuHUqa+1VKSmMln4R0fqXB4EU+Un7IkKhxD+cm4H 8U+SSL3ONqAtXHM99Lxf3LZIOjCnHT0/9ifFsWZlk37XqBaT/TBHYN+Cu96VQDlxxjg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fb9d6EPC; 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 5353E606A33B; Thu, 3 Dec 2026 08:01:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fb9d6EPC X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796284917; b=ZjN/hHxYungIWfK62YjUOzN2aFZYoV2gsDwjILR9HBJn9Ibjd/3desh+WnPvczupt1py HeyMQxCV6j/gBJ5mAMvlLXSbjhxRBOe5Sd6ZCd5IubNHb4hRDnYirTayC7vQrZg7XDc2U 6XuJkaD6DN95q6AL4KY8GLEPKunvUKTq4QgiO4K1bWetduduwgthoTumti+vklak6sBKj e9HiE9isfZjl0mUd8vDdgdziaHs73IJlTbBUWYoT3iDk91U7/RE/7mODuwANZO3EXOg0D C7rsvH2/Efzs1eS2V6dZVzy86pXAFtV1BBZLXy2NImSt5Je8zr54fMQorHjDV6rsE6w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796284917; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=uKLjXxGG5z8zM0Nk4vXsc1p9z+Ka//cmQJQ4A0UrP0s=; b=gS3Zzt2aTEN8y2GYOktLnKl40yKSCMxrieT3eflx2aY4H6JXmo9FZ8qQQVVbcH90jPqk 7FZUzFxKgAF/gyt0p3WRgrlli3wLnw3KaGMjfL5CqMjupBSaUmtbtDGA8ig2hVO6oi406 sJprkfEhGg+Lixdk+tjud6fizh8A7m2b8LSO/nQlA7KNepX0nT614Iae3AUznHJr6pyzs tJML2nCbKBoDQoGm4uFX6+gs/gwBq7YnZhfH8PWAHym25YMO+4m115v+1nvHKiPC0ic1p NVBYNYcBuNHeDoHdoMwj1DkktmQfK19wFgrX3Hc5bo8m820PTobfWUxw8DnLEHW0BEQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fb9d6EPC; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74290606A33A; Thu, 3 Dec 2026 08:01:57 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FE0A1F000C1; Thu, 3 Dec 2026 08:01:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796284917; bh=uKLjXxGG5z8zM0Nk4vXsc1p9z+Ka//cmQJQ4A0UrP0s=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=fb9d6EPCGdzVY3PgfByfDMKx+xEDJPalYnMZdq1RU9NULCKWOPJhcnSa3rXU+XGiQ g3a3YmRnfe3PT785lWBLCvRysQbh2RxGyU8acA+XGcbNAYqLhBqzFnt0VrfjnUwWSR oY00b0D9U+isuDbAy3XUpO4ynBQyU5HOZfCKo9OJZ34MMUmg7u6cMQX5iS65M40xlx bzrYYyCHuE91oV+v3HL0WBeE0xcY34PWgG6ZYZ9AKoo3yl+y6Tifo3zissowGXsKFn 8HGJs4ImQs7GjKxY6hO0GVzI1/CznEb0jBEyqMNu0/5FfhCFmX++09FkGcKVz0Ck7u wRBPYWKfZSoNg== X-Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, aleksandr.loktionov@intel.com, horms@kernel.org, michal.swiatkowski@linux.intel.com, grzegorz.nitka@intel.com, pmenzel@molgen.mpg.de, wojciech.drewek@intel.com, marcin.szycik@linux.intel.com, martyna.szapar-mudlaw@linux.intel.com, ivecera@redhat.com, alice.michael@intel.com, jacob.e.keller@intel.com, jbrandeb@kernel.org, patryk.holda@intel.com, sx.rinitha@intel.com, aaron.ma@canonical.com, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261202071642.2527605-3-poros@redhat.com> X-sashiko-severity: Low 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