summaryrefslogtreecommitdiff
path: root/net/bridge
diff options
context:
space:
mode:
authorZhang Changzhong <zhangchangzhong@huawei.com>2020-12-04 16:48:56 +0800
committerJakub Kicinski <kuba@kernel.org>2020-12-04 15:41:06 -0800
commitee4f52a8de2c6f78b01f10b4c330867d88c1653a (patch)
tree7c1b1268c50c41320b101498b767c4441c6fffb4 /net/bridge
parentb410f04eb5b482b5efc4eee90de81ad35d3d923b (diff)
net: bridge: vlan: fix error return code in __vlan_add()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: f8ed289fab84 ("bridge: vlan: use br_vlan_(get|put)_master to deal with refcounts") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com> Link: https://lore.kernel.org/r/1607071737-33875-1-git-send-email-zhangchangzhong@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_vlan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 3e493eb85bb2..08c77418c687 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -266,8 +266,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags,
}
masterv = br_vlan_get_master(br, v->vid, extack);
- if (!masterv)
+ if (!masterv) {
+ err = -ENOMEM;
goto out_filt;
+ }
v->brvlan = masterv;
if (br_opt_get(br, BROPT_VLAN_STATS_PER_PORT)) {
v->stats = netdev_alloc_pcpu_stats(struct br_vlan_stats);