diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-10-03 16:43:53 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-10-03 16:43:53 +0000 |
commit | 664e716c25187e8df24c685ad24616ba16bf6205 (patch) | |
tree | 56665a3f1021af1784fe972cd6365ad9b07d458e /sys/netinet/tcp_usrreq.c | |
parent | 9ada79011110198e0b48f901fda0f53caae40a5b (diff) |
System calls should not fail due to temporary memory shortage in
malloc(9) or pool_get(9).
Pass down a wait flag to pru_attach(). During syscall socket(2)
it is ok to wait, this logic was missing for internet pcb. Pfkey
and route sockets were already waiting.
sonewconn() must not wait when called during TCP 3-way handshake.
This logic has been preserved. Unix domain stream socket connect(2)
can wait until the other side has created the socket to accept.
OK mvs@
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 7968aacbe3a..85083ee1fe0 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.208 2022/09/13 09:05:47 mvs Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.209 2022/10/03 16:43:52 bluhm Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -460,7 +460,7 @@ tcp_ctloutput(int op, struct socket *so, int level, int optname, * buffer space, and entering LISTEN state to accept connections. */ int -tcp_attach(struct socket *so, int proto) +tcp_attach(struct socket *so, int proto, int wait) { struct tcpcb *tp; struct inpcb *inp; @@ -477,11 +477,11 @@ tcp_attach(struct socket *so, int proto) } NET_ASSERT_LOCKED(); - error = in_pcballoc(so, &tcbtable); + error = in_pcballoc(so, &tcbtable, wait); if (error) return (error); inp = sotoinpcb(so); - tp = tcp_newtcpcb(inp); + tp = tcp_newtcpcb(inp, wait); if (tp == NULL) { unsigned int nofd = so->so_state & SS_NOFDREF; /* XXX */ |