Commit 4e4b5376 authored by Hannes Frederic Sowa's avatar Hannes Frederic Sowa Committed by David S. Miller

netlink: validate addr_len on bind

Otherwise an out of bounds read could happen.
Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9f1e0ad0
...@@ -669,6 +669,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, ...@@ -669,6 +669,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
int err; int err;
if (addr_len < sizeof(struct sockaddr_nl))
return -EINVAL;
if (nladdr->nl_family != AF_NETLINK) if (nladdr->nl_family != AF_NETLINK)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment