mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
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: 58e998c6d2
("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>
[lizf: Backported to 3.4:
- remove ETH_P_8021AD
- pass protocol to harmonize_features()]
Signed-off-by: Zefan Li <lizefan@huawei.com>
This commit is contained in:
parent
6fb66b080a
commit
3f2bfecbcd
1 changed files with 8 additions and 6 deletions
|
@ -2143,12 +2143,14 @@ netdev_features_t 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue