From: Li RongQing Date: Mon, 15 Oct 2018 11:00:31 +0000 (+0800) Subject: net: bridge: fix a possible memory leak in __vlan_add X-Git-Tag: Ubuntu-5.0.0-8.9~1262^2~62 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1a3aea2534f4f3083f29b2b047aa83a9d6c777a4;p=mirror_ubuntu-disco-kernel.git 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: 9163a0fc1f0c0 ("net: bridge: add support for per-port vlan stats") CC: bridge@lists.linux-foundation.org cc: Nikolay Aleksandrov CC: Roopa Prabhu Signed-off-by: Zhang Yu Signed-off-by: Li RongQing Signed-off-by: Nikolay Aleksandrov Signed-off-by: David S. Miller --- diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 9b707234e4ae..8c9297a01947 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -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; }