summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>2014-12-22 19:04:14 +0900
committerBen Hutchings <ben@decadent.org.uk>2015-02-20 00:49:32 +0000
commit8a706a29fc9feeed5fb10e87d7b2a8f8ce6e21a4 (patch)
tree55fd51b9be7f444cae2fafacf2e6a6cc5faea060 /net
parent61e8801c5ec3aebfafa10ef89873a18cd8aa3420 (diff)
net: Fix stacked vlan offload features computation
commit 796f2da81bead71ffc91ef70912cd8d1827bf756 upstream. When vlan tags are stacked, it is very likely that the outer tag is stored in skb->vlan_tci and skb->protocol shows the inner tag's vlan_proto. Currently netif_skb_features() first looks at skb->protocol even if there is the outer tag in vlan_tci, thus it incorrectly retrieves the protocol encapsulated by the inner vlan instead of the inner vlan protocol. This allows GSO packets to be passed to HW and they end up being corrupted. Fixes: 58e998c6d239 ("offloading: Force software GSO for multiple vlan tags.") Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net> [bwh: Backported to 3.2: - We don't support 802.1ad tag offload - Keep passing protocol to harmonize_features()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 854da1571997..bf43c8426245 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2128,11 +2128,13 @@ u32 netif_skb_features(struct sk_buff *skb)
if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs)
features &= ~NETIF_F_GSO_MASK;
- if (protocol == htons(ETH_P_8021Q)) {
- struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
- protocol = veh->h_vlan_encapsulated_proto;
- } else if (!vlan_tx_tag_present(skb)) {
- return harmonize_features(skb, protocol, features);
+ if (!vlan_tx_tag_present(skb)) {
+ if (unlikely(protocol == htons(ETH_P_8021Q))) {
+ struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
+ protocol = veh->h_vlan_encapsulated_proto;
+ } else {
+ return harmonize_features(skb, protocol, features);
+ }
}
features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX);