summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-01-08 21:00:33 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2019-01-08 21:00:33 +0100
commit8eaaf16019a0bde44959654faa93c417f1973d9c (patch)
tree0990ea930c38476d8636b63a737c7c1c792c5747
parent04f0977dca6e67ec8c3848900878726378a43806 (diff)
downloadipset-8eaaf16019a0bde44959654faa93c417f1973d9c.tar.gz
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>
-rw-r--r--kernel/net/netfilter/ipset/ip_set_core.c9
1 files changed, 7 insertions, 2 deletions
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;