Message ID | fa531e2ed014488baa10556c724e176c@AMSPEX02CL03.citrite.net |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On (01/25/17 15:06), Paul Durrant wrote: > > Making netfront cope with a fully non-linear skb looks like it would > be quite intrusive and probably not worth it so I opted for just doing > the ETH_HLEN pull-tail if necessary. Can you check it works for you? I tested it, and it works fine, but note that DaveM's comments in this thread: the DKI is that we *must* provide at least the hard_header_len in the non-paged part of the skb. So might not even be necessary to handle the fully non-linear skb (though it's probably prudent to check and bail for this, as your patch does) I just posted an RFC patch for fixing the pf_packet layer, just in case other drivers like xen_netfront dont explicitly check for this http://patchwork.ozlabs.org/patch/719236/
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 40f26b6..a957c89 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -567,6 +567,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) u16 queue_index; struct sk_buff *nskb; + /* Drop packets that are not at least ETH_HLEN in length */ + if (skb->len < ETH_HLEN) + goto drop; + /* Drop the packet if no queues are set up */ if (num_queues < 1) goto drop; @@ -609,6 +613,8 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) } len = skb_headlen(skb); + if ((len < ETH_HLEN) && !__pskb_pull_tail(skb, ETH_HLEN)) + goto drop; spin_lock_irqsave(&queue->tx_lock, flags);