aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2013-09-23 07:20:56 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2013-10-01 06:46:56 -0400
commitafff14f6089ac50f05f29e489c5b2a067077d560 (patch)
treea970dfc78262cde6d7d54bf265288681193d1f12 /net/netfilter
parent7433268783eda21a04bf963f9992547a848d44a4 (diff)
netfilter: nfnetlink_log: use proper net to allocate skb
Use proper net struct to allocate skb, otherwise netlink mmap will be of no effect. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nfnetlink_log.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index d92cc317bf8b..3c4b69e5fe17 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -319,7 +319,8 @@ nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags)
319} 319}
320 320
321static struct sk_buff * 321static struct sk_buff *
322nfulnl_alloc_skb(u32 peer_portid, unsigned int inst_size, unsigned int pkt_size) 322nfulnl_alloc_skb(struct net *net, u32 peer_portid, unsigned int inst_size,
323 unsigned int pkt_size)
323{ 324{
324 struct sk_buff *skb; 325 struct sk_buff *skb;
325 unsigned int n; 326 unsigned int n;
@@ -328,13 +329,13 @@ nfulnl_alloc_skb(u32 peer_portid, unsigned int inst_size, unsigned int pkt_size)
328 * message. WARNING: has to be <= 128k due to slab restrictions */ 329 * message. WARNING: has to be <= 128k due to slab restrictions */
329 330
330 n = max(inst_size, pkt_size); 331 n = max(inst_size, pkt_size);
331 skb = nfnetlink_alloc_skb(&init_net, n, peer_portid, GFP_ATOMIC); 332 skb = nfnetlink_alloc_skb(net, n, peer_portid, GFP_ATOMIC);
332 if (!skb) { 333 if (!skb) {
333 if (n > pkt_size) { 334 if (n > pkt_size) {
334 /* try to allocate only as much as we need for current 335 /* try to allocate only as much as we need for current
335 * packet */ 336 * packet */
336 337
337 skb = nfnetlink_alloc_skb(&init_net, pkt_size, 338 skb = nfnetlink_alloc_skb(net, pkt_size,
338 peer_portid, GFP_ATOMIC); 339 peer_portid, GFP_ATOMIC);
339 if (!skb) 340 if (!skb)
340 pr_err("nfnetlink_log: can't even alloc %u bytes\n", 341 pr_err("nfnetlink_log: can't even alloc %u bytes\n",
@@ -702,8 +703,8 @@ nfulnl_log_packet(struct net *net,
702 } 703 }
703 704
704 if (!inst->skb) { 705 if (!inst->skb) {
705 inst->skb = nfulnl_alloc_skb(inst->peer_portid, inst->nlbufsiz, 706 inst->skb = nfulnl_alloc_skb(net, inst->peer_portid,
706 size); 707 inst->nlbufsiz, size);
707 if (!inst->skb) 708 if (!inst->skb)
708 goto alloc_failure; 709 goto alloc_failure;
709 } 710 }