Skip to content

Commit d9d5908

Browse files
committed
openvswitch: Move LRO check from transmit to receive.
The check for LRO packets was incorrectly put in the transmit path instead of on receive. Since this check is supposed to protect OVS (and other parts of the system) from packets that it cannot handle it is obviously not useful on egress. Therefore, this commit moves it back to the receive side. The primary problem that this caused is upcalls to userspace tried to segment the packet even though no segmentation information is available. This would later cause NULL pointer dereferences when skb_gso_segment() did nothing. Signed-off-by: Jesse Gross <jesse@nicira.com>
1 parent a49f0d1 commit d9d5908

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

net/openvswitch/vport-netdev.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
/* Must be called with rcu_read_lock. */
3636
static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)
3737
{
38-
if (unlikely(!vport)) {
39-
kfree_skb(skb);
40-
return;
41-
}
38+
if (unlikely(!vport))
39+
goto error;
40+
41+
if (unlikely(skb_warn_if_lro(skb)))
42+
goto error;
4243

4344
/* Make our own copy of the packet. Otherwise we will mangle the
4445
* packet for anyone who came before us (e.g. tcpdump via AF_PACKET).
@@ -50,6 +51,10 @@ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)
5051

5152
skb_push(skb, ETH_HLEN);
5253
ovs_vport_receive(vport, skb);
54+
return;
55+
56+
error:
57+
kfree_skb(skb);
5358
}
5459

5560
/* Called with rcu_read_lock and bottom-halves disabled. */
@@ -169,9 +174,6 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
169174
goto error;
170175
}
171176

172-
if (unlikely(skb_warn_if_lro(skb)))
173-
goto error;
174-
175177
skb->dev = netdev_vport->dev;
176178
len = skb->len;
177179
dev_queue_xmit(skb);

0 commit comments

Comments
 (0)