diff options
author | David Ahern <dsahern@kernel.org> | 2021-12-30 17:36:34 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-11 13:57:36 +0100 |
commit | 652d322a21bf2f21cb6b4b90986666c95fce8bbe (patch) | |
tree | 34f4256fde5aa2fa14cac41393a28f66561ce465 | |
parent | 647cbb5eb84de28dda8b15452cb25e448dd27835 (diff) | |
download | linux-rt-652d322a21bf2f21cb6b4b90986666c95fce8bbe.tar.gz |
ipv6: Check attribute length for RTA_GATEWAY when deleting multipath route
commit 1ff15a710a862db1101b97810af14aedc835a86a upstream.
Make sure RTA_GATEWAY for IPv6 multipath route has enough bytes to hold
an IPv6 address.
Fixes: 6b9ea5a64ed5 ("ipv6: fix multipath route replace error recovery")
Signed-off-by: David Ahern <dsahern@kernel.org>
Cc: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/ipv6/route.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 5daef9396566..9ae48a20c320 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3365,7 +3365,11 @@ static int ip6_route_multipath_del(struct fib6_config *cfg, nla = nla_find(attrs, attrlen, RTA_GATEWAY); if (nla) { - nla_memcpy(&r_cfg.fc_gateway, nla, 16); + err = fib6_gw_from_attr(&r_cfg.fc_gateway, nla, + extack); + if (err) + return err; + r_cfg.fc_flags |= RTF_GATEWAY; } } |