Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: poros@redhat.com
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
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	[thread overview]
Message-ID: <179628491563.3146.9047666199900210939@kernel.org> (raw)
In-Reply-To: <20261202071642.2527605-3-poros@redhat.com>

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

  reply	other threads:[~2026-12-03  8:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  7:16 [PATCH net v7 0/4] ice: fix DFLT Rx rule handling for promisc and switchdev Petr Oros
2026-12-02  7:16 ` [PATCH net v7 1/4] ice: stop the service task before the PF is unloaded Petr Oros
2026-12-03  8:01   ` netdev-bot+sashiko
2026-12-02  7:16 ` [PATCH net v7 2/4] ice: do not leave switchdev mode while subfunction ports exist Petr Oros
2026-12-03  8:01   ` netdev-bot+sashiko [this message]
2026-12-02  7:16 ` [PATCH net v7 3/4] ice: resync uplink filters after a switchdev session Petr Oros
2026-12-03  8:01   ` netdev-bot+sashiko
2026-12-02  7:16 ` [PATCH net v7 4/4] ice: use a VLAN agnostic multicast promisc rule pair for PF VSIs Petr Oros

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=179628491563.3146.9047666199900210939@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aaron.ma@canonical.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=alice.michael@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=grzegorz.nitka@intel.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ivecera@redhat.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jbrandeb@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.szycik@linux.intel.com \
    --cc=martyna.szapar-mudlaw@linux.intel.com \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=patryk.holda@intel.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=poros@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sx.rinitha@intel.com \
    --cc=wojciech.drewek@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox