Commit b8f22570 authored by Joe Stringer's avatar Joe Stringer Committed by David S. Miller

openvswitch: Fix skb leak in ovs_fragment()

If ovs_fragment() was unable to fragment the skb due to an L2 header
that exceeds the supported length, skbs would be leaked. Fix the bug.

Fixes: 7f8a436e "openvswitch: Add conntrack action"
Signed-off-by: default avatarJoe Stringer <joestringer@nicira.com>
Acked-by: default avatarPravin B Shelar <pshelar@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a7cc172
...@@ -684,7 +684,7 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru, ...@@ -684,7 +684,7 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
{ {
if (skb_network_offset(skb) > MAX_L2_LEN) { if (skb_network_offset(skb) > MAX_L2_LEN) {
OVS_NLERR(1, "L2 header too long to fragment"); OVS_NLERR(1, "L2 header too long to fragment");
return; goto err;
} }
if (ethertype == htons(ETH_P_IP)) { if (ethertype == htons(ETH_P_IP)) {
...@@ -708,8 +708,7 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru, ...@@ -708,8 +708,7 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
struct rt6_info ovs_rt; struct rt6_info ovs_rt;
if (!v6ops) { if (!v6ops) {
kfree_skb(skb); goto err;
return;
} }
prepare_frag(vport, skb); prepare_frag(vport, skb);
...@@ -728,8 +727,12 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru, ...@@ -728,8 +727,12 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru,
WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.", WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
ovs_vport_name(vport), ntohs(ethertype), mru, ovs_vport_name(vport), ntohs(ethertype), mru,
vport->dev->mtu); vport->dev->mtu);
kfree_skb(skb); goto err;
} }
return;
err:
kfree_skb(skb);
} }
static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port, static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment