Skip to contentSkip to conversation

flow_dissector: Check skb for VLAN only if skb specified.

PATCH Applied Eric Garver 5 participants 6 messages Oct 17, 2016 – Oct 19, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 flow_dissector: Check skb for VLAN only if skb specified.

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

Fixes d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")
---
 net/core/flow_dissector.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/core/flow_dissector.c +2 -4
index 1a7b80f73376..44e6ba9d3a6b 100644
@@ -247,12 +247,10 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 	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),
Signature · 1 line
2.5.5
Reviewed-by on v2 1/1
#1 lore raw
Quoted 13 lines · Eric Garver

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

Fixes d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")
---
 net/core/flow_dissector.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/core/flow_dissector.c +0 -0
index 1a7b80f73376..44e6ba9d3a6b 100644

net/core/flow_dissector.c bool __skb_flow_dissect(const struct sk_buff *skb, · line 252

Quoted 7 lines
net/core/flow_dissector.c +1 -1
@@ -247,12 +247,10 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 	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;
 

I was a bit confused that we check skb for VLAN tag again later in the same block but this time without a NULL check. However, this only happens when we get called from skb_flow_dissect() or skb_flow_dissect_flow_keys() variants, which take an skb and pass it to us.

Feel free to add:

#2 lore raw
In reply to Eric Garver
Quoted 4 lines · Eric Garver

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

Fixes d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")

Dave,

Hadar is OOO and I have asked Amir to look on the fix, will appreciate if we can have 24 hours to respond

Or.

#4 lore raw
In reply to Amir Vadai
Quoted 9 lines · Amir Vadai
Quoted 8 lines · Or Gerlitz
Quoted 4 lines · Eric Garver

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

Fixes d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")

Dave,

Quoted 8 lines
Quoted 4 lines

Hadar is OOO and I have asked Amir to look on the fix, will appreciate if we can have 24 hours to respond

Or.

Reviewed and tested.

Amir,

Your ACK may have been lost on its way to the list. I received it, but it's not showing on any list archives or patchwork.

Acked-by
#3 lore raw
In reply to Or Gerlitz
Quoted 6 lines · Or Gerlitz
Quoted 4 lines · Eric Garver

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

Fixes d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")
Quoted 6 lines

Dave,

Hadar is OOO and I have asked Amir to look on the fix, will appreciate if we can have 24 hours to respond

Or.

Reviewed and tested.