From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FE0A1F000C1; Thu, 3 Dec 2026 08:01:56 +0000 (UTC) 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== Subject: Re: [PATCH net v7 2/4] ice: do not leave switchdev mode while subfunction ports exist 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 Date: Thu, 03 Dec 2026 08:01:55 +0000 Message-ID: <179628491563.3146.9047666199900210939@kernel.org> In-Reply-To: <20261202071642.2527605-3-poros@redhat.com> References: <20261202071642.2527605-3-poros@redhat.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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