Skip to content

Commit

Permalink
net/sched: act_tunnel_key: disambiguate metadata dst error cases
Browse files Browse the repository at this point in the history
Metadata may be NULL for one of two reasons:
* Missing user input
* Failure to allocate the metadata dst

Disambiguate these case by returning -EINVAL for the former and -ENOMEM
for the latter rather than -EINVAL for both cases.

This is in preparation for using extended ack to provide more information
to users when parsing their input.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Simon Horman authored and David S. Miller committed Jun 29, 2018
1 parent c90d160 commit a1165b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/sched/act_tunnel_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, dst_port,
0, flags,
key_id, 0);
} else {
ret = -EINVAL;
goto err_out;
}

if (!metadata) {
ret = -EINVAL;
ret = -ENOMEM;
goto err_out;
}

Expand Down

0 comments on commit a1165b5

Please sign in to comment.