mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
net/ipv4: Check for mistakenly passed in non-IPv4 address
[ Upstream commit d0733d2e29b652b2e7b1438ececa732e4eed98eb ] 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: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Willy Tarreau <w@1wt.eu>
This commit is contained in:
parent
af79350f15
commit
93050f523a
@ -458,6 +458,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user