]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: bridge: switchdev: check br_vlan_group() return value
authorClément Léger <clement.leger@bootlin.com>
Thu, 21 Apr 2022 10:12:47 +0000 (12:12 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 22 Apr 2022 22:12:18 +0000 (15:12 -0700)
br_vlan_group() can return NULL and thus return value must be checked
to avoid dereferencing a NULL pointer.

Fixes: bb1ca20da57f ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations")
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://lore.kernel.org/r/20220421101247.121896-1-clement.leger@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/bridge/br_switchdev.c

index 8cc44c36723171e77f2695c22d9bfd70bcdfb6cc..18affda2b522ac952effa064ac87adf1dee6c3b2 100644 (file)
@@ -353,6 +353,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) {