Jelajahi Sumber

netfilter: ipset: fix crash if IPSET_CMD_NONE command is sent

This patch fixes a crash if that ipset command is sent over nfnetlink.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka 13 tahun lalu
induk
melakukan
d31f4d448f
1 mengubah file dengan 12 tambahan dan 0 penghapusan
  1. 12 0
      net/netfilter/ipset/ip_set_core.c

+ 12 - 0
net/netfilter/ipset/ip_set_core.c

@@ -639,6 +639,14 @@ find_free_id(const char *name, ip_set_id_t *index, struct ip_set **set)
 	return 0;
 	return 0;
 }
 }
 
 
+static int
+ip_set_none(struct sock *ctnl, struct sk_buff *skb,
+	    const struct nlmsghdr *nlh,
+	    const struct nlattr * const attr[])
+{
+	return -EOPNOTSUPP;
+}
+
 static int
 static int
 ip_set_create(struct sock *ctnl, struct sk_buff *skb,
 ip_set_create(struct sock *ctnl, struct sk_buff *skb,
 	      const struct nlmsghdr *nlh,
 	      const struct nlmsghdr *nlh,
@@ -1539,6 +1547,10 @@ nlmsg_failure:
 }
 }
 
 
 static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = {
 static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = {
+	[IPSET_CMD_NONE]	= {
+		.call		= ip_set_none,
+		.attr_count	= IPSET_ATTR_CMD_MAX,
+	},
 	[IPSET_CMD_CREATE]	= {
 	[IPSET_CMD_CREATE]	= {
 		.call		= ip_set_create,
 		.call		= ip_set_create,
 		.attr_count	= IPSET_ATTR_CMD_MAX,
 		.attr_count	= IPSET_ATTR_CMD_MAX,