Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112566850
D49153.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D49153.diff
View Options
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -435,7 +435,7 @@
inp->inp_lport, &inp->inp_inc.inc_ie.ie_dependladdr,
INPCBLBGROUP_SIZMIN, numa_domain, fib);
if (grp == NULL)
- return (ENOBUFS);
+ return (ENOMEM);
in_pcblbgroup_insert(grp, inp);
CK_LIST_INSERT_HEAD(hdr, grp, il_list);
} else if (grp->il_inpcnt + grp->il_pendcnt == grp->il_inpsiz) {
@@ -449,7 +449,7 @@
/* Expand this local group. */
grp = in_pcblbgroup_resize(hdr, grp, grp->il_inpsiz * 2);
if (grp == NULL)
- return (ENOBUFS);
+ return (ENOMEM);
in_pcblbgroup_insert(grp, inp);
} else {
in_pcblbgroup_insert(grp, inp);
@@ -732,11 +732,12 @@
&inp->inp_lport, flags, cred);
if (error)
return (error);
- if (in_pcbinshash(inp) != 0) {
+ if (__predict_false((error = in_pcbinshash(inp)) != 0)) {
+ MPASS(inp->inp_socket->so_options & SO_REUSEPORT_LB);
inp->inp_laddr.s_addr = INADDR_ANY;
inp->inp_lport = 0;
inp->inp_flags &= ~INP_BOUNDFIB;
- return (EAGAIN);
+ return (error);
}
if (anonport)
inp->inp_flags |= INP_ANONPORT;
@@ -2611,6 +2612,10 @@
/*
* Insert PCB onto various hash lists.
+ *
+ * With normal sockets this function shall not fail, so it could return void.
+ * But for SO_REUSEPORT_LB it may need to allocate memory with locks held,
+ * that's the only condition when it can fail.
*/
int
in_pcbinshash(struct inpcb *inp)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 10:40 PM (6 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17045743
Default Alt Text
D49153.diff (1 KB)
Attached To
Mode
D49153: inpcb: return ENOMEM if bind(2) fails to allocate lbgroup
Attached
Detach File
Event Timeline
Log In to Comment