Clément Léger
2022-Apr-21 10:12 UTC
[Bridge] [PATCH net-next] net: bridge: switchdev: check br_vlan_group() return value
br_vlan_group() can return NULL and thus return value must be checked to avoid dereferencing a NULL pointer. Fixes: 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations") Signed-off-by: Cl?ment L?ger <clement.leger at bootlin.com> --- net/bridge/br_switchdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index 81400e0b26ac..8f3d76c751dd 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -354,6 +354,8 @@ static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, attr.orig_dev = br_dev; vg = br_vlan_group(br); + if (!vg) + return 0; list_for_each_entry(v, &vg->vlan_list, vlist) { if (v->msti) { -- 2.34.1
Nikolay Aleksandrov
2022-Apr-21 10:17 UTC
[Bridge] [PATCH net-next] net: bridge: switchdev: check br_vlan_group() return value
On 21/04/2022 13:12, Cl?ment L?ger wrote:> br_vlan_group() can return NULL and thus return value must be checked > to avoid dereferencing a NULL pointer. > > Fixes: 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations") > Signed-off-by: Cl?ment L?ger <clement.leger at bootlin.com> > --- > net/bridge/br_switchdev.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c > index 81400e0b26ac..8f3d76c751dd 100644 > --- a/net/bridge/br_switchdev.c > +++ b/net/bridge/br_switchdev.c > @@ -354,6 +354,8 @@ static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, > attr.orig_dev = br_dev; > > vg = br_vlan_group(br); > + if (!vg) > + return 0; > > list_for_each_entry(v, &vg->vlan_list, vlist) { > if (v->msti) {Good catch. Acked-by: Nikolay Aleksandrov <razor at blackwall.org>
patchwork-bot+netdevbpf at kernel.org
2022-Apr-22 22:20 UTC
[Bridge] [PATCH net-next] net: bridge: switchdev: check br_vlan_group() return value
Hello: This patch was applied to netdev/net.git (master) by Jakub Kicinski <kuba at kernel.org>: On Thu, 21 Apr 2022 12:12:47 +0200 you wrote:> br_vlan_group() can return NULL and thus return value must be checked > to avoid dereferencing a NULL pointer. > > Fixes: 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations") > Signed-off-by: Cl?ment L?ger <clement.leger at bootlin.com> > --- > net/bridge/br_switchdev.c | 2 ++ > 1 file changed, 2 insertions(+)Here is the summary with links: - [net-next] net: bridge: switchdev: check br_vlan_group() return value https://git.kernel.org/netdev/net/c/7f40ea2145d9 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html