aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@citrix.com>2014-03-26 18:37:45 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-27 15:29:38 -0400
commit36d5fe6a000790f56039afe26834265db0a3ad4c (patch)
tree391de83f18ede9ca651ed347112ce4400e4645d5 /net/netfilter
parentfc0d48b8fb449ca007b2057328abf736cb516168 (diff)
core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors
skb_zerocopy can copy elements of the frags array between skbs, but it doesn't orphan them. Also, it doesn't handle errors, so this patch takes care of that as well, and modify the callers accordingly. skb_tx_error() is also added to the callers so they will signal the failed delivery towards the creator of the skb. Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nfnetlink_queue_core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index f072fe803510..108120f216b1 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -354,13 +354,16 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
354 354
355 skb = nfnetlink_alloc_skb(net, size, queue->peer_portid, 355 skb = nfnetlink_alloc_skb(net, size, queue->peer_portid,
356 GFP_ATOMIC); 356 GFP_ATOMIC);
357 if (!skb) 357 if (!skb) {
358 skb_tx_error(entskb);
358 return NULL; 359 return NULL;
360 }
359 361
360 nlh = nlmsg_put(skb, 0, 0, 362 nlh = nlmsg_put(skb, 0, 0,
361 NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, 363 NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET,
362 sizeof(struct nfgenmsg), 0); 364 sizeof(struct nfgenmsg), 0);
363 if (!nlh) { 365 if (!nlh) {
366 skb_tx_error(entskb);
364 kfree_skb(skb); 367 kfree_skb(skb);
365 return NULL; 368 return NULL;
366 } 369 }
@@ -488,13 +491,15 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
488 nla->nla_type = NFQA_PAYLOAD; 491 nla->nla_type = NFQA_PAYLOAD;
489 nla->nla_len = nla_attr_size(data_len); 492 nla->nla_len = nla_attr_size(data_len);
490 493
491 skb_zerocopy(skb, entskb, data_len, hlen); 494 if (skb_zerocopy(skb, entskb, data_len, hlen))
495 goto nla_put_failure;
492 } 496 }
493 497
494 nlh->nlmsg_len = skb->len; 498 nlh->nlmsg_len = skb->len;
495 return skb; 499 return skb;
496 500
497nla_put_failure: 501nla_put_failure:
502 skb_tx_error(entskb);
498 kfree_skb(skb); 503 kfree_skb(skb);
499 net_err_ratelimited("nf_queue: error creating packet message\n"); 504 net_err_ratelimited("nf_queue: error creating packet message\n");
500 return NULL; 505 return NULL;