Fix order of arguments in fib[46]_lookup calls in SCTP.

r360292 introduced the wrong order, resulting in returned
 nhops not being referenced, despite the fact that references
 were requested. That lead to random GPF after using SCTP sockets.

Special defined macro like IPV[46]_SCOPE_GLOBAL will be introduced
 soon to reduce the chance of putting arguments in wrong order.

Reported-by: syzbot+5c813c01096363174684@syzkaller.appspotmail.com
This commit is contained in:
Alexander V. Chernikov 2020-04-26 13:02:42 +00:00
parent 32f32669c3
commit 17cb6ddba8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360337

View File

@ -403,9 +403,9 @@ typedef struct route sctp_route_t;
{ \
if ((ro)->ro_nh == NULL) { \
if ((ro)->ro_dst.sa_family == AF_INET) \
(ro)->ro_nh = fib4_lookup(fibnum, ((struct sockaddr_in *)&(ro)->ro_dst)->sin_addr, NHR_REF, 0, 0); \
(ro)->ro_nh = fib4_lookup(fibnum, ((struct sockaddr_in *)&(ro)->ro_dst)->sin_addr, 0, NHR_REF, 0); \
if ((ro)->ro_dst.sa_family == AF_INET6) \
(ro)->ro_nh = fib6_lookup(fibnum, &((struct sockaddr_in6 *)&(ro)->ro_dst)->sin6_addr, NHR_REF, 0, 0); \
(ro)->ro_nh = fib6_lookup(fibnum, &((struct sockaddr_in6 *)&(ro)->ro_dst)->sin6_addr, 0, NHR_REF, 0); \
} \
}