flow_dissector: Check skb for VLAN only if skb specified.

Fixes a panic when calling eth_get_headlen(). Noticed on i40e driver.

Fixes: d5709f7ab7 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")
Signed-off-by: Eric Garver <[email protected]>
Reviewed-by: Jakub Sitnicki <[email protected]>
Acked-by: Amir Vadai <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Eric Garver authored and David S. Miller committed 2016-10-19 10:35:46 -04:00
1 parent b4f0fd4baa
commit 3805a938a6
1 file changed
+2 -4
+2 -4
View File
@@ -247,12 +247,10 @@ ipv6:
case htons(ETH_P_8021Q): {
const struct vlan_hdr *vlan;
if (skb_vlan_tag_present(skb))
if (skb && skb_vlan_tag_present(skb))
proto = skb->protocol;
if (!skb_vlan_tag_present(skb) ||
proto == cpu_to_be16(ETH_P_8021Q) ||
proto == cpu_to_be16(ETH_P_8021AD)) {
if (eth_type_vlan(proto)) {
struct vlan_hdr _vlan;
vlan = __skb_header_pointer(skb, nhoff, sizeof(_vlan),