net/sysfs: Fix the bitrot in network device kobject namespace support
[safe/jmp/linux-2.6] / net / netfilter / nfnetlink_log.c
index 66a6dd5..fc9a211 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/list.h>
 #include <linux/jhash.h>
 #include <linux/random.h>
+#include <linux/slab.h>
 #include <net/sock.h>
 #include <net/netfilter/nf_log.h>
 #include <net/netfilter/nfnetlink_log.h>
@@ -296,7 +297,7 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size)
        n = max(inst_size, pkt_size);
        skb = alloc_skb(n, GFP_ATOMIC);
        if (!skb) {
-               PRINTR("nfnetlink_log: can't alloc whole buffer (%u bytes)\n",
+               pr_notice("nfnetlink_log: can't alloc whole buffer (%u bytes)\n",
                        inst_size);
 
                if (n > pkt_size) {
@@ -305,7 +306,7 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size)
 
                        skb = alloc_skb(pkt_size, GFP_ATOMIC);
                        if (!skb)
-                               PRINTR("nfnetlink_log: can't even alloc %u "
+                               pr_err("nfnetlink_log: can't even alloc %u "
                                       "bytes\n", pkt_size);
                }
        }
@@ -323,7 +324,8 @@ __nfulnl_send(struct nfulnl_instance *inst)
                          NLMSG_DONE,
                          sizeof(struct nfgenmsg));
 
-       status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT);
+       status = nfnetlink_unicast(inst->skb, &init_net, inst->peer_pid,
+                                  MSG_DONTWAIT);
 
        inst->qlen = 0;
        inst->skb = NULL;
@@ -666,8 +668,7 @@ nfulnl_rcv_nl_event(struct notifier_block *this,
 {
        struct netlink_notify *n = ptr;
 
-       if (event == NETLINK_URELEASE &&
-           n->protocol == NETLINK_NETFILTER && n->pid) {
+       if (event == NETLINK_URELEASE && n->protocol == NETLINK_NETFILTER) {
                int i;
 
                /* destroy all instances for this pid */
@@ -678,7 +679,7 @@ nfulnl_rcv_nl_event(struct notifier_block *this,
                        struct hlist_head *head = &instance_table[i];
 
                        hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) {
-                               if ((n->net == &init_net) &&
+                               if ((net_eq(n->net, &init_net)) &&
                                    (n->pid == inst->peer_pid))
                                        __instance_destroy(inst);
                        }
@@ -694,7 +695,8 @@ static struct notifier_block nfulnl_rtnl_notifier = {
 
 static int
 nfulnl_recv_unsupp(struct sock *ctnl, struct sk_buff *skb,
-                 struct nlmsghdr *nlh, struct nlattr *nfqa[])
+                  const struct nlmsghdr *nlh,
+                  const struct nlattr * const nfqa[])
 {
        return -ENOTSUPP;
 }
@@ -716,7 +718,8 @@ static const struct nla_policy nfula_cfg_policy[NFULA_CFG_MAX+1] = {
 
 static int
 nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
-                  struct nlmsghdr *nlh, struct nlattr *nfula[])
+                  const struct nlmsghdr *nlh,
+                  const struct nlattr * const nfula[])
 {
        struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
        u_int16_t group_num = ntohs(nfmsg->res_id);
@@ -766,7 +769,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
                        }
 
                        instance_destroy(inst);
-                       goto out;
+                       goto out_put;
                default:
                        ret = -ENOTSUPP;
                        break;