All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: Check the argument for listen(2)
@ 2013-06-28 16:22 Changli Gao
  2013-06-28 16:33 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Changli Gao @ 2013-06-28 16:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: Changli Gao, netdev

As we use u16 to save the value of the argument for listen(2),
we'd better check if the value is larger than SINT_MAX other
than cut it down silently on error.
---
 net/ipv4/af_inet.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index b4d0be2..35aaf00 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -198,6 +198,9 @@ int inet_listen(struct socket *sock, int backlog)
 	unsigned char old_state;
 	int err;
 
+	if (backlog >= (1 << 16))
+		return -EINVAL;
+
 	lock_sock(sk);
 
 	err = -EINVAL;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-28 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 16:22 [PATCH v2] net: Check the argument for listen(2) Changli Gao
2013-06-28 16:33 ` Eric Dumazet
2013-06-28 16:47   ` Changli Gao
2013-06-28 18:01   ` Rick Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.