Skip to contentSkip to conversation

ice: Avoid tracing bridge ports after initialization failure

PATCH In review Alex Kazinsky 2 participants 3 messages Nov 18

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: Avoid tracing bridge ports after initialization failure

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")
---
 drivers/net/ethernet/intel/ice/ice_eswitch_br.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch_br.c +4 -2
index 1d8a6b95ccda..6d07c15ba9d8 100644
@@ -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");
Signature · 1 line
2.56.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.

Signature · 2 lines
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
#2 lore raw
Quoted 9 lines · 18.11.2026 11:48, [email protected] wrote:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.

Quoted 6 lines

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.

Hi!
This change was not tested on real hardware.