diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index f25fa75fe651..7f9f2d0ef0e6 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1899,8 +1899,10 @@ static void packet_parse_headers(struct sk_buff *skb, struct socket *sock) /* Move network header to the right position for VLAN tagged packets */ if (likely(skb->dev->type == ARPHRD_ETHER) && eth_type_vlan(skb->protocol) && - __vlan_get_protocol(skb, skb->protocol, &depth) != 0) - skb_set_network_header(skb, depth); + __vlan_get_protocol(skb, skb->protocol, &depth) != 0) { + if (pskb_may_pull(skb, depth)) + skb_set_network_header(skb, depth); + } skb_probe_transport_header(skb); }