inpcb: return ENOMEM if bind(2) fails to allocate lbgroup

This is exactly the same as the second part of IPv4's change
136c5e17b61a1/D49153.
This commit is contained in:
Gleb Smirnoff committed 2026-07-15 12:07:53 -07:00
1 parent ca4eb3f398
commit 3abd3d3cf3
1 file changed
+6 -4
+6 -4
View File
@@ -137,10 +137,11 @@ in6_pcbsetport_locked(struct in6_addr *laddr, struct inpcb *inp,
return (error);
inp->inp_lport = lport;
if (in_pcbinshash(inp) != 0) {
if (__predict_false((error = in_pcbinshash(inp)) != 0)) {
MPASS(inp->inp_socket->so_options & SO_REUSEPORT_LB);
inp->in6p_laddr = in6addr_any;
inp->inp_lport = 0;
return (EAGAIN);
return (error);
}
inp->inp_flags |= INP_ANONPORT;
@@ -361,12 +362,13 @@ in6_pcbbind(struct inpcb *inp, struct sockaddr_in6 *sin6, int flags,
}
} else {
inp->inp_lport = lport;
if (in_pcbinshash(inp) != 0) {
if (__predict_false((error = in_pcbinshash(inp)) != 0)) {
MPASS(inp->inp_socket->so_options & SO_REUSEPORT_LB);
INP_HASH_WUNLOCK(inp->inp_pcbinfo);
inp->inp_flags &= ~INP_BOUNDFIB;
inp->in6p_laddr = in6addr_any;
inp->inp_lport = 0;
return (EAGAIN);
return (error);
}
}
INP_HASH_WUNLOCK(inp->inp_pcbinfo);