aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMarcus Meissner <meissner@suse.de>2011-06-01 21:05:22 -0700
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-05-17 11:21:06 -0400
commit020ad7b48dd828c8e281188b1dfd40d57b4c156e (patch)
tree999a057a92574f162adbd507d27259cc780fdba9 /net
parent2c92bce21378239199838eb0c3471c8cb3a93dc1 (diff)
net/ipv4: Check for mistakenly passed in non-IPv4 address
commit d0733d2e29b652b2e7b1438ececa732e4eed98eb upstream. Check against mistakenly passing in IPv6 addresses (which would result in an INADDR_ANY bind) or similar incompatible sockaddrs. Signed-off-by: Marcus Meissner <meissner@suse.de> Cc: Reinhard Max <max@suse.de> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/af_inet.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index f7135742238..8897b3c7d05 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -462,6 +462,9 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
if (addr_len < sizeof(struct sockaddr_in))
goto out;
+ if (addr->sin_family != AF_INET)
+ goto out;
+
chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
/* Not specified by any standard per-se, however it breaks too