patch-2.3.17 linux/net/socket.c

Next file: linux/net/unix/af_unix.c
Previous file: linux/net/rose/af_rose.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.16/linux/net/socket.c linux/net/socket.c
@@ -42,6 +42,8 @@
  *		Andi Kleen	:	Some small cleanups, optimizations,
  *					and fixed a copy_from_user() bug.
  *		Tigran Aivazian	:	sys_send(args) calls sys_sendto(args, NULL, 0)
+ *		Tigran Aivazian	:	Made listen(2) backlog sanity checks 
+ *					protocol-independent
  *
  *
  *		This program is free software; you can redistribute it and/or
@@ -894,6 +896,10 @@
 	int err;
 	
 	if ((sock = sockfd_lookup(fd, &err)) != NULL) {
+		if ((unsigned) backlog == 0)	/* BSDism */
+			backlog = 1;
+		if ((unsigned) backlog > SOMAXCONN)
+			backlog = SOMAXCONN;
 		err=sock->ops->listen(sock, backlog);
 		sockfd_put(sock);
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)