Skip to contentSkip to conversation

dpaa2-switch: reject VLAN uppers while bridged

PATCH Applied Ioana Ciornei 2 participants 5 messages Jun 18 – Jun 21

Subsystems (3)
lore
Share & tools
lore

Ioana Ciornei

author maintainer
#0 lore raw

v2 cover dpaa2-switch: reject VLAN uppers while bridged

The dpaa2-switch driver does not support VLAN uppers on its ports while they are bridged. The check which should have prevented a port with a VLAN upper to join bridge was poorly refactored and didn't actually return an error. Patch 2/2 fixes that.

On the other hand, the driver didn't reject the addition of a VLAN upper while bridged. Patch 1/2 fixes that.

Changes in v2:
- added patch 1/2

Ioana Ciornei (2):
dpaa2-switch: do not accept VLAN uppers while bridged
dpaa2-switch: fix VLAN upper check not rejecting bridge join

 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v2 1/2 dpaa2-switch: do not accept VLAN uppers while bridged

The dpaa2-switch driver does not support VLAN uppers while its ports are bridged. This scenario tried to be prevented by rejecting a bridge join while VLAN uppers exist but the reverse order was still possible.

This patches adds a check so that the dpaa2-switch also does not accept VLAN uppers while bridged.

Fixes f48298d3fbfa ("staging: dpaa2-switch: move the driver out of staging")

---
Changes in v2:
- patch is new

 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +8 -0
index 45f276c2c3ec..83ccefdac59f 100644
@@ -2233,6 +2233,7 @@ dpaa2_switch_prechangeupper_sanity_checks(struct net_device *netdev,
 static int dpaa2_switch_port_prechangeupper(struct net_device *netdev,
 					    struct netdev_notifier_changeupper_info *info)
 {
+	struct ethsw_port_priv *port_priv;
 	struct netlink_ext_ack *extack;
 	struct net_device *upper_dev;
 	int err;
@@ -2251,6 +2252,13 @@ static int dpaa2_switch_port_prechangeupper(struct net_device *netdev,
 
 		if (!info->linking)
 			dpaa2_switch_port_pre_bridge_leave(netdev);
+	} else if (is_vlan_dev(upper_dev)) {
+		port_priv = netdev_priv(netdev);
+		if (port_priv->fdb->bridge_dev) {
+			NL_SET_ERR_MSG_MOD(extack,
+					   "Cannot accept VLAN uppers while bridged");
+			return -EOPNOTSUPP;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH v2 2/2 dpaa2-switch: fix VLAN upper check not rejecting bridge join

In reply to Ioana Ciornei

The blamed commit refactored the prechangeupper event handling but failed to actually return an error in case dpaa2_switch_prevent_bridging_with_8021q_upper() detected a 802.1q upper on a port which tries to join a bridge. Fix this by returning err instead of 0.

Fixes 45035febc495 ("net: dpaa2-switch: refactor prechangeupper sanity checks")

---
Changes in v2:
- none

 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +1 -1
index 83ccefdac59f..858ba844ac51 100644
@@ -2212,7 +2212,7 @@ dpaa2_switch_prechangeupper_sanity_checks(struct net_device *netdev,
 	if (err) {
 		NL_SET_ERR_MSG_MOD(extack,
 				   "Cannot join a bridge while VLAN uppers are present");
-		return 0;
+		return err;
 	}
 
 	netdev_for_each_lower_dev(upper_dev, other_dev, iter) {
Signature · 1 line
2.25.1
#3 lore raw
In reply to Ioana Ciornei
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 18 Jun 2026 12:28:11 +0300 you wrote:

The dpaa2-switch driver does not support VLAN uppers on its ports while they are bridged. The check which should have prevented a port with a VLAN upper to join bridge was poorly refactored and didn't actually return an error. Patch 2/2 fixes that.

On the other hand, the driver didn't reject the addition of a VLAN upper while bridged. Patch 1/2 fixes that.

[...]

Here is the summary with links:
- [net,v2,1/2] dpaa2-switch: do not accept VLAN uppers while bridged (no matching commit)
- [net,v2,2/2] dpaa2-switch: fix VLAN upper check not rejecting bridge join

    https://git.kernel.org/netdev/net/c/ed2294f94e34

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#4 lore raw
In reply to Ioana Ciornei
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 18 Jun 2026 12:28:11 +0300 you wrote:

The dpaa2-switch driver does not support VLAN uppers on its ports while they are bridged. The check which should have prevented a port with a VLAN upper to join bridge was poorly refactored and didn't actually return an error. Patch 2/2 fixes that.

On the other hand, the driver didn't reject the addition of a VLAN upper while bridged. Patch 1/2 fixes that.

[...]

Here is the summary with links:
- [net,v2,1/2] dpaa2-switch: do not accept VLAN uppers while bridged

    https://git.kernel.org/netdev/net/c/d07d80b6a129

- [net,v2,2/2] dpaa2-switch: fix VLAN upper check not rejecting bridge join (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html