From: Hannes Frederic Sowa Date: Sat, 15 Dec 2012 15:42:19 +0000 (+0000) Subject: netlink: validate addr_len on bind X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4e4b53768f1ddce38b7f6edcad3a063020ef0024;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git netlink: validate addr_len on bind Otherwise an out of bounds read could happen. Signed-off-by: Hannes Frederic Sowa Signed-off-by: David S. Miller --- diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 9ee52b6a12dd..c0353d55d56f 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -669,6 +669,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; int err; + if (addr_len < sizeof(struct sockaddr_nl)) + return -EINVAL; + if (nladdr->nl_family != AF_NETLINK) return -EINVAL;