net: sparx5: mdb add/del handle non-sparx5 devices
Subsystems (3)
PATCH 1/1 net: sparx5: mdb add/del handle non-sparx5 devices
When adding/deleting mdb entries on other net_devices, eg., tap interfaces, it should not crash.
--- drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c +6 -0
@@ -397,6 +397,9 @@ static int sparx5_handle_port_mdb_add(struct net_device *dev,bool is_host;int res, err; +if (!sparx5_netdevice_check (dev)) +return -EOPNOTSUPP ; + is_host =netif_is_bridge_master (v->obj.orig_dev);/* When VLAN unaware the vlan value is not parsed and we receive vid 0.
@@ -480,6 +483,9 @@ static int sparx5_handle_port_mdb_del(struct net_device *dev,u32 mact_entry, res, pgid_entry[3 ], misc_cfg;bool host_ena; +if (!sparx5_netdevice_check (dev)) +return -EOPNOTSUPP ; +if (!br_vlan_enabled (spx5->hw_bridge_dev)) vid =1 ;else
Signature · 1 line
2.30.2
Hi Casper,
Quoted 34 lines · Casper Andersson
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
When adding/deleting mdb entries on other
net_devices, eg., tap interfaces, it should not crash.Signed-off-by Casper Andersson <[email protected]>---
drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c | 6 ++++++1 file changed, 6 insertions(+)drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c +6
-0@@ -397,6 +397,9 @@ static int sparx5_handle_port_mdb_add(struct net_device *dev, bool is_host; int res, err; + if (!sparx5_netdevice_check(dev)) + return -EOPNOTSUPP; + is_host = netif_is_bridge_master(v->obj.orig_dev); /* When VLAN unaware the vlan value is not parsed and we receive vid 0.@@ -480,6 +483,9 @@ static int sparx5_handle_port_mdb_del(struct net_device *dev, u32 mact_entry, res, pgid_entry[3], misc_cfg; bool host_ena; + if (!sparx5_netdevice_check(dev)) + return -EOPNOTSUPP; + if (!br_vlan_enabled(spx5->hw_bridge_dev)) vid = 1;
Quoted 4 lines
else
--
2.30.2
Indeed!
Signature · 5 lines
Best Regards Steen -=-=-=-=-=-=-=-=-=-=-=-=-=-= [email protected]
Jakub Kicinski
maintainerQuoted 9 lines · On Tue, 28 Jun 2022 14:55:22 +0200 Steen Hegelund wrote:
Quoted 6 lines · Casper Andersson
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
When adding/deleting mdb entries on other
net_devices, eg., tap interfaces, it should not crash.Signed-off-by Casper Andersson <[email protected]>Reviewed-by Steen Hegelund <[email protected]>
We need a Fixes tag here, when did it start crashing?
Sorry, yes. This is supposed to go to net, not net-next. I will resubmit with a fixes tag.
Best Regards,
Casper
Quoted 12 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 28 Jun 2022 14:55:22 +0200 Steen Hegelund wrote:
Quoted 6 lines · Casper Andersson
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
When adding/deleting mdb entries on other
net_devices, eg., tap interfaces, it should not crash.Signed-off-by Casper Andersson <[email protected]>Reviewed-by Steen Hegelund <[email protected]>We need a Fixes tag here, when did it start crashing?