Commit 1a3aea25 authored by Li RongQing's avatar Li RongQing Committed by David S. Miller

net: bridge: fix a possible memory leak in __vlan_add

After per-port vlan stats, vlan stats should be released
when fail to add vlan

Fixes: 9163a0fc ("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: default avatarZhang Yu <zhangyu31@baidu.com>
Signed-off-by: default avatarLi RongQing <lirongqing@baidu.com>
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bc0e7cf4
...@@ -303,6 +303,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags) ...@@ -303,6 +303,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags)
if (p) { if (p) {
__vlan_vid_del(dev, br, v->vid); __vlan_vid_del(dev, br, v->vid);
if (masterv) { if (masterv) {
if (v->stats && masterv->stats != v->stats)
free_percpu(v->stats);
v->stats = NULL;
br_vlan_put_master(masterv); br_vlan_put_master(masterv);
v->brvlan = NULL; v->brvlan = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment