]> Git Repo - linux.git/commitdiff
net: sparx5: mdb add/del handle non-sparx5 devices
authorCasper Andersson <[email protected]>
Thu, 30 Jun 2022 12:22:26 +0000 (14:22 +0200)
committerJakub Kicinski <[email protected]>
Thu, 30 Jun 2022 18:32:54 +0000 (11:32 -0700)
When adding/deleting mdb entries on other net_devices, eg., tap
interfaces, it should not crash.

Fixes: 3bacfccdcb2d ("net: sparx5: Add mdb handlers")
Signed-off-by: Casper Andersson <[email protected]>
Reviewed-by: Steen Hegelund <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c

index 3429660cd2e5d4b778b1f18beaaeec6ddeb4cc5a..5edc8b7176c822eabbf319c9d1afd3e9f984fe81 100644 (file)
@@ -396,6 +396,9 @@ static int sparx5_handle_port_mdb_add(struct net_device *dev,
        u32 mact_entry;
        int res, err;
 
+       if (!sparx5_netdevice_check(dev))
+               return -EOPNOTSUPP;
+
        if (netif_is_bridge_master(v->obj.orig_dev)) {
                sparx5_mact_learn(spx5, PGID_CPU, v->addr, v->vid);
                return 0;
@@ -466,6 +469,9 @@ static int sparx5_handle_port_mdb_del(struct net_device *dev,
        u32 mact_entry, res, pgid_entry[3];
        int err;
 
+       if (!sparx5_netdevice_check(dev))
+               return -EOPNOTSUPP;
+
        if (netif_is_bridge_master(v->obj.orig_dev)) {
                sparx5_mact_forget(spx5, v->addr, v->vid);
                return 0;
This page took 0.048972 seconds and 4 git commands to generate.