aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/ipset
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-06-10 12:47:37 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2019-06-10 12:47:37 +0200
commitf4f5748bfec94cf418e49bf05f0c81a1b9ebc950 (patch)
treee4cddf11a3a97e856a2f13fa6fbf18b22f225513 /net/netfilter/ipset
parentnetfilter: ipset: merge uadd and udel functions (diff)
downloadlinux-dev-f4f5748bfec94cf418e49bf05f0c81a1b9ebc950.tar.xz
linux-dev-f4f5748bfec94cf418e49bf05f0c81a1b9ebc950.zip
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 <pakki001@umn.edu> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'net/netfilter/ipset')
-rw-r--r--net/netfilter/ipset/ip_set_core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 2ad609900b22..d0f4c627ff91 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1544,10 +1544,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_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr,
- nlh->nlmsg_len - min_len,
- ip_set_adt_policy, NULL);
+ ret = nla_parse_deprecated(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;