Skip to content

Commit f4f5748

Browse files
Aditya PakkiJozsef Kadlecsik
authored andcommitted
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>
1 parent f0cb839 commit f4f5748

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

net/netfilter/ipset/ip_set_core.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,10 +1544,14 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set,
15441544
memcpy(&errmsg->msg, nlh, nlh->nlmsg_len);
15451545
cmdattr = (void *)&errmsg->msg + min_len;
15461546

1547-
nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr,
1548-
nlh->nlmsg_len - min_len,
1549-
ip_set_adt_policy, NULL);
1547+
ret = nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr,
1548+
nlh->nlmsg_len - min_len,
1549+
ip_set_adt_policy, NULL);
15501550

1551+
if (ret) {
1552+
nlmsg_free(skb2);
1553+
return ret;
1554+
}
15511555
errline = nla_data(cda[IPSET_ATTR_LINENO]);
15521556

15531557
*errline = lineno;

0 commit comments

Comments
 (0)