netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Garver <e@erig.me>
To: netdev@vger.kernel.org
Cc: Hadar Hen Zion <hadarh@mellanox.com>
Subject: [PATCH net v2] flow_dissector: Check skb for VLAN only if skb specified.
Date: Mon, 17 Oct 2016 16:30:12 -0400	[thread overview]
Message-ID: <1476736212-21238-1-git-send-email-e@erig.me> (raw)

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")
Signed-off-by: Eric Garver <e@erig.me>
---
 net/core/flow_dissector.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 1a7b80f73376..44e6ba9d3a6b 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -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),
-- 
2.5.5

             reply	other threads:[~2016-10-17 20:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 20:30 Eric Garver [this message]
2016-10-18 12:44 ` [PATCH net v2] flow_dissector: Check skb for VLAN only if skb specified Jakub Sitnicki
2016-10-18 13:59 ` Or Gerlitz
2016-10-19  8:44   ` Amir Vadai
2016-10-19 14:00     ` Eric Garver
2016-10-19 14:36 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476736212-21238-1-git-send-email-e@erig.me \
    --to=e@erig.me \
    --cc=hadarh@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).