From: Andrej <andrej@ota.si>
To: linux-kernel@vger.kernel.org
Cc: romieu@fr.zoreil.com, davem@davemloft.net
Subject: via-rhine: fix VLAN receive handling error in 4.2.x
Date: Sat, 3 Oct 2015 18:21:54 +0100 [thread overview]
Message-ID: <20151003172155.77A8AF404@mta2.toshio.eu> (raw)
Hi,
via-rhine driver in 4.2.x kernels doesn’t correctly parse VLAN ID on receive. A bug was introduced in the commit 810f19bcb862f8889b27e0c9d9eceac9593925dd. All 4.2.x kernels are affected. 4.1.x and older kernels are not affected.
During code refactoring, the sequence of calls changed which introduced a regression. Original sequence was:
1) Read TCI from skb->data
2) Determine eth protocol using eth_type_trans (which calls skb_pull_inline)
3) Write TCI to skb->vlan_tci
After the change, the sequence is:
1) Determine protocol using eth_type_trans (which calls skb_pull_inline)
2) Read TCI from skb->data
3) Write TCI to skb->vlan_tci
Because eth_type_trans consumes ethernet header worth of bytes, a call to read TCI from packet no longer works as expected as it’s reading from invalid offset.
Choosing between changing rhine_get_vlan_tci(), which retrieves TCI from skb->data, or moving eth_type_trans() invocation after rhine_rx_vlan_tag(), I chose the latter.
Andrej.
--- linux-4.2.2.orig/drivers/net/ethernet/via/via-rhine.c 2015-10-03 15:46:59.817000000 +0200
+++ linux-4.2.2/drivers/net/ethernet/via/via-rhine.c 2015-10-03 18:53:51.799000000 +0200
@@ -2134,10 +2134,11 @@
}
skb_put(skb, pkt_len);
- skb->protocol = eth_type_trans(skb, dev);
rhine_rx_vlan_tag(skb, desc, data_size);
+ skb->protocol = eth_type_trans(skb, dev);
+
netif_receive_skb(skb);
u64_stats_update_begin(&rp->rx_stats.syncp);
next reply other threads:[~2015-10-03 17:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-03 17:21 Andrej [this message]
2015-10-03 21:47 ` Francois Romieu
2015-10-04 20:05 ` [PATCH] " Andrej Ota
2015-10-06 7:34 ` Francois Romieu
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=20151003172155.77A8AF404@mta2.toshio.eu \
--to=andrej@ota.si \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
/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
all inboxes | Powered by JetHome®