aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/datapath.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openvswitch/datapath.c')
-rw-r--r--net/openvswitch/datapath.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 7228ec3faf19..64dc864a417f 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -78,11 +78,12 @@ static const struct genl_multicast_group ovs_dp_vport_multicast_group = {
78 78
79/* Check if need to build a reply message. 79/* Check if need to build a reply message.
80 * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */ 80 * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */
81static bool ovs_must_notify(struct genl_info *info, 81static bool ovs_must_notify(struct genl_family *family, struct genl_info *info,
82 const struct genl_multicast_group *grp) 82 unsigned int group)
83{ 83{
84 return info->nlhdr->nlmsg_flags & NLM_F_ECHO || 84 return info->nlhdr->nlmsg_flags & NLM_F_ECHO ||
85 netlink_has_listeners(genl_info_net(info)->genl_sock, 0); 85 genl_has_listeners(family, genl_info_net(info)->genl_sock,
86 group);
86} 87}
87 88
88static void ovs_notify(struct genl_family *family, 89static void ovs_notify(struct genl_family *family,
@@ -265,8 +266,11 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
265 upcall.key = &key; 266 upcall.key = &key;
266 upcall.userdata = NULL; 267 upcall.userdata = NULL;
267 upcall.portid = ovs_vport_find_upcall_portid(p, skb); 268 upcall.portid = ovs_vport_find_upcall_portid(p, skb);
268 ovs_dp_upcall(dp, skb, &upcall); 269 error = ovs_dp_upcall(dp, skb, &upcall);
269 consume_skb(skb); 270 if (unlikely(error))
271 kfree_skb(skb);
272 else
273 consume_skb(skb);
270 stats_counter = &stats->n_missed; 274 stats_counter = &stats->n_missed;
271 goto out; 275 goto out;
272 } 276 }
@@ -404,7 +408,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
404{ 408{
405 struct ovs_header *upcall; 409 struct ovs_header *upcall;
406 struct sk_buff *nskb = NULL; 410 struct sk_buff *nskb = NULL;
407 struct sk_buff *user_skb; /* to be queued to userspace */ 411 struct sk_buff *user_skb = NULL; /* to be queued to userspace */
408 struct nlattr *nla; 412 struct nlattr *nla;
409 struct genl_info info = { 413 struct genl_info info = {
410 .dst_sk = ovs_dp_get_net(dp)->genl_sock, 414 .dst_sk = ovs_dp_get_net(dp)->genl_sock,
@@ -494,9 +498,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
494 ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len; 498 ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
495 499
496 err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); 500 err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);
501 user_skb = NULL;
497out: 502out:
498 if (err) 503 if (err)
499 skb_tx_error(skb); 504 skb_tx_error(skb);
505 kfree_skb(user_skb);
500 kfree_skb(nskb); 506 kfree_skb(nskb);
501 return err; 507 return err;
502} 508}
@@ -758,7 +764,7 @@ static struct sk_buff *ovs_flow_cmd_alloc_info(const struct sw_flow_actions *act
758{ 764{
759 struct sk_buff *skb; 765 struct sk_buff *skb;
760 766
761 if (!always && !ovs_must_notify(info, &ovs_dp_flow_multicast_group)) 767 if (!always && !ovs_must_notify(&dp_flow_genl_family, info, 0))
762 return NULL; 768 return NULL;
763 769
764 skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL); 770 skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL);