diff options
Diffstat (limited to 'net/openvswitch')
-rw-r--r-- | net/openvswitch/actions.c | 5 | ||||
-rw-r--r-- | net/openvswitch/datapath.c | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index fe5cda0deb39..5231652a95d9 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -42,6 +42,9 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
42 | 42 | ||
43 | static int make_writable(struct sk_buff *skb, int write_len) | 43 | static int make_writable(struct sk_buff *skb, int write_len) |
44 | { | 44 | { |
45 | if (!pskb_may_pull(skb, write_len)) | ||
46 | return -ENOMEM; | ||
47 | |||
45 | if (!skb_cloned(skb) || skb_clone_writable(skb, write_len)) | 48 | if (!skb_cloned(skb) || skb_clone_writable(skb, write_len)) |
46 | return 0; | 49 | return 0; |
47 | 50 | ||
@@ -70,6 +73,8 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci) | |||
70 | 73 | ||
71 | vlan_set_encap_proto(skb, vhdr); | 74 | vlan_set_encap_proto(skb, vhdr); |
72 | skb->mac_header += VLAN_HLEN; | 75 | skb->mac_header += VLAN_HLEN; |
76 | if (skb_network_offset(skb) < ETH_HLEN) | ||
77 | skb_set_network_header(skb, ETH_HLEN); | ||
73 | skb_reset_mac_len(skb); | 78 | skb_reset_mac_len(skb); |
74 | 79 | ||
75 | return 0; | 80 | return 0; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 7228ec3faf19..91d66b7e64ac 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -265,8 +265,11 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb) | |||
265 | upcall.key = &key; | 265 | upcall.key = &key; |
266 | upcall.userdata = NULL; | 266 | upcall.userdata = NULL; |
267 | upcall.portid = ovs_vport_find_upcall_portid(p, skb); | 267 | upcall.portid = ovs_vport_find_upcall_portid(p, skb); |
268 | ovs_dp_upcall(dp, skb, &upcall); | 268 | error = ovs_dp_upcall(dp, skb, &upcall); |
269 | consume_skb(skb); | 269 | if (unlikely(error)) |
270 | kfree_skb(skb); | ||
271 | else | ||
272 | consume_skb(skb); | ||
270 | stats_counter = &stats->n_missed; | 273 | stats_counter = &stats->n_missed; |
271 | goto out; | 274 | goto out; |
272 | } | 275 | } |
@@ -404,7 +407,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, | |||
404 | { | 407 | { |
405 | struct ovs_header *upcall; | 408 | struct ovs_header *upcall; |
406 | struct sk_buff *nskb = NULL; | 409 | struct sk_buff *nskb = NULL; |
407 | struct sk_buff *user_skb; /* to be queued to userspace */ | 410 | struct sk_buff *user_skb = NULL; /* to be queued to userspace */ |
408 | struct nlattr *nla; | 411 | struct nlattr *nla; |
409 | struct genl_info info = { | 412 | struct genl_info info = { |
410 | .dst_sk = ovs_dp_get_net(dp)->genl_sock, | 413 | .dst_sk = ovs_dp_get_net(dp)->genl_sock, |
@@ -494,9 +497,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, | |||
494 | ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len; | 497 | ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len; |
495 | 498 | ||
496 | err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); | 499 | err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); |
500 | user_skb = NULL; | ||
497 | out: | 501 | out: |
498 | if (err) | 502 | if (err) |
499 | skb_tx_error(skb); | 503 | skb_tx_error(skb); |
504 | kfree_skb(user_skb); | ||
500 | kfree_skb(nskb); | 505 | kfree_skb(nskb); |
501 | return err; | 506 | return err; |
502 | } | 507 | } |