tcp_drain(): initialize the inpcb iterator when curvnet is set

Reported by:	cy
Pointy hat to:	glebius
Fixes:		de2d47842e
This commit is contained in:
Gleb Smirnoff 2021-12-02 21:08:30 -08:00
parent 651a545143
commit 12ae3476f3

View File

@ -2613,8 +2613,6 @@ tcp_close(struct tcpcb *tp)
void
tcp_drain(void)
{
struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
INPLOOKUP_WLOCKPCB);
VNET_ITERATOR_DECL(vnet_iter);
if (!do_tcpdrain)
@ -2623,6 +2621,8 @@ tcp_drain(void)
VNET_LIST_RLOCK_NOSLEEP();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
INPLOOKUP_WLOCKPCB);
struct inpcb *inpb;
struct tcpcb *tcpb;