netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: sparx5: mdb add/del handle non-sparx5 devices
@ 2022-06-30 12:22 Casper Andersson
  2022-06-30 18:33 ` Jakub Kicinski
  2022-06-30 18:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Casper Andersson @ 2022-06-30 12:22 UTC (permalink / raw)
  To: Jakub Kicinski, David S. Miller, Paolo Abeni
  Cc: Steen Hegelund, Eric Dumazet, Lars Povlsen, UNGLinuxDriver,
	netdev

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(+)

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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: sparx5: mdb add/del handle non-sparx5 devices
  2022-06-30 12:22 [PATCH net] net: sparx5: mdb add/del handle non-sparx5 devices Casper Andersson
@ 2022-06-30 18:33 ` Jakub Kicinski
  2022-06-30 18:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-06-30 18:33 UTC (permalink / raw)
  To: Casper Andersson
  Cc: David S. Miller, Paolo Abeni, Steen Hegelund, Eric Dumazet,
	Lars Povlsen, UNGLinuxDriver, netdev

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: sparx5: mdb add/del handle non-sparx5 devices
  2022-06-30 12:22 [PATCH net] net: sparx5: mdb add/del handle non-sparx5 devices Casper Andersson
  2022-06-30 18:33 ` Jakub Kicinski
@ 2022-06-30 18:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-06-30 18:50 UTC (permalink / raw)
  To: Casper Andersson
  Cc: kuba, davem, pabeni, steen.hegelund, edumazet, lars.povlsen,
	UNGLinuxDriver, netdev

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-30 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-30 12:22 [PATCH net] net: sparx5: mdb add/del handle non-sparx5 devices Casper Andersson
2022-06-30 18:33 ` Jakub Kicinski
2022-06-30 18:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).