summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2003-01-17 19:20:00 +0000
committertmm <tmm@FreeBSD.org>2003-01-17 19:20:00 +0000
commit44a87ce9b92bb756504a91bab3f4fef496a80ea0 (patch)
treee30ebc6ea2b676d55dc3b18621aa19a6066658b7 /sys/kern
parent48bc1b69c823ca2bc326a90bc8ab10010bb472a6 (diff)
downloadFreeBSD-src-44a87ce9b92bb756504a91bab3f4fef496a80ea0.zip
FreeBSD-src-44a87ce9b92bb756504a91bab3f4fef496a80ea0.tar.gz
Disallow listen() on sockets which are in the SS_ISCONNECTED or
SS_ISCONNECTING state, returning EINVAL (which is what POSIX mandates in this case). listen() on connected or connecting sockets would cause them to enter a bad state; in the TCP case, this could cause sockets to go catatonic or panics, depending on how the socket was connected. Reviewed by: -net MFC after: 2 weeks
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index c4d596f..4163f2e 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -266,6 +266,10 @@ solisten(so, backlog, td)
int s, error;
s = splnet();
+ if (so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING)) {
+ splx(s);
+ return (EINVAL);
+ }
error = (*so->so_proto->pr_usrreqs->pru_listen)(so, td);
if (error) {
splx(s);
OpenPOWER on IntegriCloud