ipv4: Fix error return value in fib_convert_metrics()
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Tue, 19 Jun 2018 17:47:52 +0000 (18:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Jul 2018 14:26:42 +0000 (16:26 +0200)
The validation code modified by commit 5b5e7a0de2bb ("net: metrics:
add proper netlink validation") is organised differently in older
kernel versions.  The fib_convert_metrics() function that is modified
in the backports to 4.4 and 4.9 needs to returns an error code, not a
success flag.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/fib_semantics.c

index d476b79..a88dab3 100644 (file)
@@ -980,7 +980,7 @@ fib_convert_metrics(struct fib_info *fi, const struct fib_config *cfg)
                                return -EINVAL;
                } else {
                        if (nla_len(nla) != sizeof(u32))
-                               return false;
+                               return -EINVAL;
                        val = nla_get_u32(nla);
                }
                if (type == RTAX_ADVMSS && val > 65535 - 40)