inpcb: do not set INP_ANONPORT until successful operation

This commit is contained in:
Gleb Smirnoff committed 2026-07-15 12:07:48 -07:00
1 parent a48a275325
commit ca4eb3f398
1 file changed
+2 -2
+2 -2
View File
@@ -132,8 +132,6 @@ in6_pcbsetport_locked(struct in6_addr *laddr, struct inpcb *inp,
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT|SO_REUSEPORT_LB)) == 0)
lookupflags = INPLOOKUP_WILDCARD;
inp->inp_flags |= INP_ANONPORT;
error = in_pcb_lport(inp, NULL, &lport, cred, lookupflags);
if (error != 0)
return (error);
@@ -145,6 +143,8 @@ in6_pcbsetport_locked(struct in6_addr *laddr, struct inpcb *inp,
return (EAGAIN);
}
inp->inp_flags |= INP_ANONPORT;
return (0);
}