diff mbox series

[net] openvswitch: fix error return code in validate_and_copy_dec_ttl()

Message ID 20201204114314.1596-1-wanghai38@huawei.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net] openvswitch: fix error return code in validate_and_copy_dec_ttl() | expand

Checks

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, 8 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

Commit Message

Wang Hai Dec. 4, 2020, 11:43 a.m. UTC
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Changing 'return start' to 'return action_start' can fix this bug.

Fixes: 69929d4c49e1 ("net: openvswitch: fix TTL decrement action netlink message format")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 net/openvswitch/flow_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eelco Chaudron Dec. 4, 2020, 12:07 p.m. UTC | #1
On 4 Dec 2020, at 12:43, Wang Hai wrote:

> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Changing 'return start' to 'return action_start' can fix this bug.
>
> Fixes: 69929d4c49e1 ("net: openvswitch: fix TTL decrement action 
> netlink message format")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>

Thanks for fixing!

Reviewed-by: Eelco Chaudron <echaudro@redhat.com>

> ---
>  net/openvswitch/flow_netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/flow_netlink.c 
> b/net/openvswitch/flow_netlink.c
> index ec0689ddc635..4c5c2331e764 100644
> --- a/net/openvswitch/flow_netlink.c
> +++ b/net/openvswitch/flow_netlink.c
> @@ -2531,7 +2531,7 @@ static int validate_and_copy_dec_ttl(struct net 
> *net,
>
>  	action_start = add_nested_action_start(sfa, OVS_DEC_TTL_ATTR_ACTION, 
> log);
>  	if (action_start < 0)
> -		return start;
> +		return action_start;
>
>  	err = __ovs_nla_copy_actions(net, actions, key, sfa, eth_type,
>  				     vlan_tci, mpls_label_count, log);
> -- 
> 2.17.1
Jakub Kicinski Dec. 4, 2020, 11:44 p.m. UTC | #2
On Fri, 04 Dec 2020 13:07:48 +0100 Eelco Chaudron wrote:
> > Fix to return a negative error code from the error handling
> > case instead of 0, as done elsewhere in this function.
> >
> > Changing 'return start' to 'return action_start' can fix this bug.
> >
> > Fixes: 69929d4c49e1 ("net: openvswitch: fix TTL decrement action 
> > netlink message format")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Wang Hai <wanghai38@huawei.com>  
> 
> Thanks for fixing!
> 
> Reviewed-by: Eelco Chaudron <echaudro@redhat.com>

Applied, thanks!
diff mbox series

Patch

diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index ec0689ddc635..4c5c2331e764 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -2531,7 +2531,7 @@  static int validate_and_copy_dec_ttl(struct net *net,
 
 	action_start = add_nested_action_start(sfa, OVS_DEC_TTL_ATTR_ACTION, log);
 	if (action_start < 0)
-		return start;
+		return action_start;
 
 	err = __ovs_nla_copy_actions(net, actions, key, sfa, eth_type,
 				     vlan_tci, mpls_label_count, log);