]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: bridge: fix a possible memory leak in __vlan_add
authorLi RongQing <lirongqing@baidu.com>
Mon, 15 Oct 2018 11:00:31 +0000 (19:00 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Oct 2018 05:53:52 +0000 (22:53 -0700)
After per-port vlan stats, vlan stats should be released
when fail to add vlan

Fixes: 9163a0fc1f0c0 ("net: bridge: add support for per-port vlan stats")
CC: bridge@lists.linux-foundation.org
cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
CC: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_vlan.c

index 9b707234e4ae272614da4dc2a4078fafcf1f8abc..8c9297a019475fe68ee110a85cda1647deaf9075 100644 (file)
@@ -303,6 +303,10 @@ out_filt:
        if (p) {
                __vlan_vid_del(dev, br, v->vid);
                if (masterv) {
+                       if (v->stats && masterv->stats != v->stats)
+                               free_percpu(v->stats);
+                       v->stats = NULL;
+
                        br_vlan_put_master(masterv);
                        v->brvlan = NULL;
                }