From: Alex Kazinsky <a.kazinsky@ideco.ru>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: Alex Kazinsky <a.kazinsky@ideco.ru>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Pawel Chmielewski <pawel.chmielewski@intel.com>,
Wojciech Drewek <wojciech.drewek@intel.com>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org,
stable@vger.kernel.org
Subject: [PATCH net] ice: Avoid tracing bridge ports after initialization failure
Date: Wed, 18 Nov 2026 11:42:59 +0400 [thread overview]
Message-ID: <20261118074324.1583964-1-a.kazinsky@ideco.ru> (raw)
ice_eswitch_br_port_link() traces representor and uplink bridge ports
before checking whether their initialization succeeded. If allocation
fails, the port pointer remains NULL. If xa_insert() fails, the cleanup
path clears the pointer and frees the port.
With the ice_eswitch_br_port_link trace event enabled, its handler
dereferences the NULL pointer while reading the port fields.
Call the tracepoint only after successful port initialization.
Found by Linux Verification Center (linuxtesting.org) with SVACE static
analysis tool.
Fixes: d129c2a245bf ("ice: add tracepoints for the switchdev bridge")
Cc: stable@vger.kernel.org
Signed-off-by: Alex Kazinsky <a.kazinsky@ideco.ru>
---
drivers/net/ethernet/intel/ice/ice_eswitch_br.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
index 1d8a6b95ccda..6d07c15ba9d8 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
@@ -1118,7 +1118,8 @@ ice_eswitch_br_port_link(struct ice_esw_br_offloads *br_offloads,
struct ice_repr *repr = ice_netdev_to_repr(dev);
err = ice_eswitch_br_vf_repr_port_init(bridge, repr);
- trace_ice_eswitch_br_port_link(repr->br_port);
+ if (!err)
+ trace_ice_eswitch_br_port_link(repr->br_port);
} else {
struct net_device *ice_dev;
struct ice_pf *pf;
@@ -1134,7 +1135,8 @@ ice_eswitch_br_port_link(struct ice_esw_br_offloads *br_offloads,
pf = ice_netdev_to_pf(ice_dev);
err = ice_eswitch_br_uplink_port_init(bridge, pf);
- trace_ice_eswitch_br_port_link(pf->br_port);
+ if (!err)
+ trace_ice_eswitch_br_port_link(pf->br_port);
}
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Failed to init bridge port");
--
2.56.0
next reply other threads:[~2026-11-18 7:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 7:42 Alex Kazinsky [this message]
2026-11-18 7:48 ` [PATCH net] ice: Avoid tracing bridge ports after initialization failure netdev-bot+sinfo
2026-11-18 8:00 ` Алексей Казинский
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=20261118074324.1583964-1-a.kazinsky@ideco.ru \
--to=a.kazinsky@ideco.ru \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pawel.chmielewski@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=stable@vger.kernel.org \
--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