From: Pablo Neira Ayuso Date: Sun, 4 Jan 2015 14:20:29 +0000 (+0100) Subject: netfilter: nfnetlink: validate nfnetlink header from batch X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9ea2aa8b7dba;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git netfilter: nfnetlink: validate nfnetlink header from batch Make sure there is enough room for the nfnetlink header in the netlink messages that are part of the batch. There is a similar check in netlink_rcv_skb(). Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 13c2e17bbe27..c6619d4bcc32 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c @@ -321,7 +321,8 @@ replay: nlh = nlmsg_hdr(skb); err = 0; - if (nlh->nlmsg_len < NLMSG_HDRLEN) { + if (nlmsg_len(nlh) < sizeof(struct nfgenmsg) || + skb->len < nlh->nlmsg_len) { err = -EINVAL; goto ack; }