From: Vladimir Oltean Date: Tue, 13 Jul 2021 09:40:21 +0000 (+0300) Subject: net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave() X-Git-Tag: accepted/tizen/unified/20230118.172025~6815^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bcb9928a155444dbd212473e60241ca0a7f641e1;p=platform%2Fkernel%2Flinux-rpi.git net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave() 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 Signed-off-by: David S. Miller --- diff --git a/net/dsa/switch.c b/net/dsa/switch.c index 2484551..5ece05d 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);