diff options
| author | Wei Yongjun <weiyongjun1@huawei.com> | 2017-04-26 10:03:50 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-04-27 16:35:57 -0400 |
| commit | adeb45cbb5057731ce9c47aad93756135d7947bf (patch) | |
| tree | 4bdebd857bdd4491ebd9b83da6a68cec8fe1f1e4 /net/core | |
| parent | 99f906e9ad7b6e79ffeda30f45906a8448b9d6a2 (diff) | |
fib_rules: fix error return code
Fix to return error code -EINVAL from the error handling
case instead of 0, as done elsewhere in this function.
Fixes: 622ec2c9d524 ("net: core: add UID to flows, rules, and routes")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
| -rw-r--r-- | net/core/fib_rules.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index c58c1df6f92b..f21c4d3aeae0 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
| @@ -440,6 +440,7 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
| 440 | if (tb[FRA_TUN_ID]) | 440 | if (tb[FRA_TUN_ID]) |
| 441 | rule->tun_id = nla_get_be64(tb[FRA_TUN_ID]); | 441 | rule->tun_id = nla_get_be64(tb[FRA_TUN_ID]); |
| 442 | 442 | ||
| 443 | err = -EINVAL; | ||
| 443 | if (tb[FRA_L3MDEV]) { | 444 | if (tb[FRA_L3MDEV]) { |
| 444 | #ifdef CONFIG_NET_L3_MASTER_DEV | 445 | #ifdef CONFIG_NET_L3_MASTER_DEV |
| 445 | rule->l3mdev = nla_get_u8(tb[FRA_L3MDEV]); | 446 | rule->l3mdev = nla_get_u8(tb[FRA_L3MDEV]); |
| @@ -461,7 +462,6 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
| 461 | else | 462 | else |
| 462 | rule->suppress_ifgroup = -1; | 463 | rule->suppress_ifgroup = -1; |
| 463 | 464 | ||
| 464 | err = -EINVAL; | ||
| 465 | if (tb[FRA_GOTO]) { | 465 | if (tb[FRA_GOTO]) { |
| 466 | if (rule->action != FR_ACT_GOTO) | 466 | if (rule->action != FR_ACT_GOTO) |
| 467 | goto errout_free; | 467 | goto errout_free; |
| @@ -592,8 +592,10 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
| 592 | 592 | ||
| 593 | if (tb[FRA_UID_RANGE]) { | 593 | if (tb[FRA_UID_RANGE]) { |
| 594 | range = nla_get_kuid_range(tb); | 594 | range = nla_get_kuid_range(tb); |
| 595 | if (!uid_range_set(&range)) | 595 | if (!uid_range_set(&range)) { |
| 596 | err = -EINVAL; | ||
| 596 | goto errout; | 597 | goto errout; |
| 598 | } | ||
| 597 | } else { | 599 | } else { |
| 598 | range = fib_kuid_range_unset; | 600 | range = fib_kuid_range_unset; |
| 599 | } | 601 | } |
