[PATCH net] net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave()

Subsystems: networking [dsa], networking [general], the rest

STALE1870d

3 messages, 3 authors, 2021-07-13 · open the first message on its own page

[PATCH net] net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave()

From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: 2021-07-13 09:40:39

This was not caught because there is no switch driver which implements
the .port_bridge_join but not .port_bridge_leave method, but it should
nonetheless be fixed, as in certain conditions (driver development) it
might lead to NULL pointer dereference.

Fixes: f66a6a69f97a ("net: dsa: permit cross-chip bridging between all trees in the system")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/dsa/switch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index 248455145982..5ece05dfd8f2 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -113,11 +113,11 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
 	int err, port;
 
 	if (dst->index == info->tree_index && ds->index == info->sw_index &&
-	    ds->ops->port_bridge_join)
+	    ds->ops->port_bridge_leave)
 		ds->ops->port_bridge_leave(ds, info->port, info->br);
 
 	if ((dst->index != info->tree_index || ds->index != info->sw_index) &&
-	    ds->ops->crosschip_bridge_join)
+	    ds->ops->crosschip_bridge_leave)
 		ds->ops->crosschip_bridge_leave(ds, info->tree_index,
 						info->sw_index, info->port,
 						info->br);
-- 
2.25.1

Re: [PATCH net] net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave()

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-07-13 22:00:05

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue, 13 Jul 2021 12:40:21 +0300 you wrote:
This was not caught because there is no switch driver which implements
the .port_bridge_join but not .port_bridge_leave method, but it should
nonetheless be fixed, as in certain conditions (driver development) it
might lead to NULL pointer dereference.

Fixes: f66a6a69f97a ("net: dsa: permit cross-chip bridging between all trees in the system")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

[...]
Here is the summary with links:
  - [net] net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave()
    https://git.kernel.org/netdev/net/c/bcb9928a1554

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Re: [PATCH net] net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave()

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-07-13 22:03:00

On 7/13/21 2:40 AM, Vladimir Oltean wrote:
This was not caught because there is no switch driver which implements
the .port_bridge_join but not .port_bridge_leave method, but it should
nonetheless be fixed, as in certain conditions (driver development) it
might lead to NULL pointer dereference.

Fixes: f66a6a69f97a ("net: dsa: permit cross-chip bridging between all trees in the system")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Too late but yes:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help