Message ID | 1607071737-33875-1-git-send-email-zhangchangzhong@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] net: bridge: vlan: fix error return code in __vlan_add() | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 11 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On 04/12/2020 10:48, Zhang Changzhong wrote: > 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> > --- > net/bridge/br_vlan.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c > index 3e493eb..08c7741 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); > Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
On Fri, 4 Dec 2020 12:47:07 +0200 Nikolay Aleksandrov wrote: > On 04/12/2020 10:48, Zhang Changzhong wrote: > > 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> Applied, thanks!
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 3e493eb..08c7741 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);
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> --- net/bridge/br_vlan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)