From: Aditya Pakki Date: Tue, 8 Jan 2019 20:00:33 +0000 (+0100) Subject: netfilter: ipset: fix a missing check of nla_parse X-Git-Tag: v7.3~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8eaaf16019a0bde44959654faa93c417f1973d9c;p=ipset netfilter: ipset: fix a missing check of nla_parse When nla_parse fails, we should not use the results (the first argument). The fix checks if it fails, and if so, returns its error code upstream. Signed-off-by: Aditya Pakki Signed-off-by: Jozsef Kadlecsik --- diff --git a/kernel/net/netfilter/ipset/ip_set_core.c b/kernel/net/netfilter/ipset/ip_set_core.c index e820f2e..a3739be 100644 --- a/kernel/net/netfilter/ipset/ip_set_core.c +++ b/kernel/net/netfilter/ipset/ip_set_core.c @@ -1564,9 +1564,14 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set, memcpy(&errmsg->msg, nlh, nlh->nlmsg_len); cmdattr = (void *)&errmsg->msg + min_len; - NLA_PARSE(cda, IPSET_ATTR_CMD_MAX, cmdattr, - nlh->nlmsg_len - min_len, ip_set_adt_policy, NULL); + ret = NLA_PARSE(cda, IPSET_ATTR_CMD_MAX, cmdattr, + nlh->nlmsg_len - min_len, ip_set_adt_policy, + NULL); + if (ret) { + nlmsg_free(skb2); + return ret; + } errline = nla_data(cda[IPSET_ATTR_LINENO]); *errline = lineno;