diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2026-07-15 18:49:32 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2026-07-15 19:07:53 +0000 |
| commit | 3abd3d3cf3f034cb3d4250a95a8d6c41e72971ef (patch) | |
| tree | 87c8e19a475289e326ae921bfe2415c5d4f17ac4 | |
| parent | ca4eb3f3989b64dc371c2f114eecae28b25a6481 (diff) | |
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.
| -rw-r--r-- | sys/netinet6/in6_pcb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index b5859777eee9..fc4cd3c9b1ad 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -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); |
