diff mbox series

[net] net: sparx5: mdb add/del handle non-sparx5 devices

Message ID 20220630122226.316812-1-casper.casan@gmail.com (mailing list archive)
State Accepted
Commit 9c5de246c1dbe785268fc2e83c88624b92e4ec93
Delegated to: Netdev Maintainers
Headers show
Series [net] net: sparx5: mdb add/del handle non-sparx5 devices | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 3 maintainers not CCed: linux-arm-kernel@lists.infradead.org vladimir.oltean@nxp.com Steen.Hegelund@microchip.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 2
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Casper Andersson June 30, 2022, 12:22 p.m. UTC
When adding/deleting mdb entries on other net_devices, eg., tap
interfaces, it should not crash.

Fixes: 3bacfccdcb2d

Signed-off-by: Casper Andersson <casper.casan@gmail.com>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jakub Kicinski June 30, 2022, 6:33 p.m. UTC | #1
On Thu, 30 Jun 2022 14:22:26 +0200 Casper Andersson wrote:
> Fixes: 3bacfccdcb2d

Please note the correct format includes the title, so:

Fixes: 3bacfccdcb2d ("net: sparx5: Add mdb handlers")

Also you should have kept the review tags you already received.

I'll fix when applying, thanks.
patchwork-bot+netdevbpf@kernel.org June 30, 2022, 6:50 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 30 Jun 2022 14:22:26 +0200 you wrote:
> When adding/deleting mdb entries on other net_devices, eg., tap
> interfaces, it should not crash.
> 
> Fixes: 3bacfccdcb2d
> 
> Signed-off-by: Casper Andersson <casper.casan@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net] net: sparx5: mdb add/del handle non-sparx5 devices
    https://git.kernel.org/netdev/net/c/9c5de246c1db

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
index 3429660cd2e5..5edc8b7176c8 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
@@ -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;