]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net/sched: act_tunnel_key: disambiguate metadata dst error cases
authorSimon Horman <simon.horman@netronome.com>
Wed, 27 Jun 2018 04:39:34 +0000 (21:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Jun 2018 14:50:26 +0000 (23:50 +0900)
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>
net/sched/act_tunnel_key.c

index 626dac81a48a6b2ab97e9d0c786b08989f693288..2edd389e7c92731310e5a7ab7f41421591153037 100644 (file)
@@ -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;
                }