sctp: hold the inp lock while calling ip6_output

This fixes an issue with handling IPPROTO_IPV6 level socket
options.

Reported by:	syzbot+66ede232c3d1271c6226@syzkaller.appspotmail.com
MFC after:	3 days
This commit is contained in:
Michael Tuexen 2022-04-19 13:03:08 +02:00
parent f2edc91557
commit a12d89332e

View File

@ -428,9 +428,11 @@ typedef struct route sctp_route_t;
\
m_clrprotoflags(o_pak); \
if (local_inp != NULL) { \
INP_RLOCK(&local_inp->ip_inp.inp); \
result = ip6_output(o_pak, \
local_inp->ip_inp.inp.in6p_outputopts, \
(ro), 0, 0, ifp, NULL); \
INP_RUNLOCK(&local_inp->ip_inp.inp); \
} else { \
result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \
} \