Skip to content

Commit 350bfd4

Browse files
author
Hangbin Liu
committed
ipv6: Set errno after ip_fib_metrics_init() in ip6_route_info_create().
JIRA: https://issues.redhat.com/browse/RHEL-84573 Upstream Status: net.git commit 9a81fc3 commit 9a81fc3 Author: Kuniyuki Iwashima <kuniyu@amazon.com> Date: Tue Mar 11 18:38:48 2025 -0700 ipv6: Set errno after ip_fib_metrics_init() in ip6_route_info_create(). While creating a new IPv6, we could get a weird -ENOMEM when RTA_NH_ID is set and either of the conditions below is true: 1) CONFIG_IPV6_SUBTREES is enabled and rtm_src_len is specified 2) nexthop_get() fails e.g.) # strace ip -6 route add fe80::dead:beef:dead:beef nhid 1 from :: recvmsg(3, {msg_iov=[{iov_base=[...[ {error=-ENOMEM, msg=[... [...]]}, [{nla_len=49, nla_type=NLMSGERR_ATTR_MSG}, "Nexthops can not be used with so"...] ]], iov_len=32768}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 148 Let's set err explicitly after ip_fib_metrics_init() in ip6_route_info_create(). Fixes: f88d8ea ("ipv6: Plumb support for nexthop object in a fib6_info") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20250312013854.61125-1-kuniyu@amazon.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Hangbin Liu <haliu@redhat.com>
1 parent 4ec89c5 commit 350bfd4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv6/route.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3827,10 +3827,12 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
38273827
if (nh) {
38283828
if (rt->fib6_src.plen) {
38293829
NL_SET_ERR_MSG(extack, "Nexthops can not be used with source routing");
3830+
err = -EINVAL;
38303831
goto out_free;
38313832
}
38323833
if (!nexthop_get(nh)) {
38333834
NL_SET_ERR_MSG(extack, "Nexthop has been deleted");
3835+
err = -ENOENT;
38343836
goto out_free;
38353837
}
38363838
rt->nh = nh;

0 commit comments

Comments
 (0)