On 5/28/19 1:50 PM, Davide Caratti wrote:
> Like it has been done in commit 2ecba2d1e45b ("net: sched: act_csum: Fix
> csum calc for tagged packets"), also 'pedit' needs to adjust the network
> offset when multiple tags are present in the packets: otherwise wrong IP
> headers (but good checksums) can be observed with the following command:
...
> +again:
> + switch (protocol) {
> + case cpu_to_be16(ETH_P_8021AD): /* fall through */
> + case cpu_to_be16(ETH_P_8021Q):
> + if (skb_vlan_tag_present(skb) &&
> + !orig_vlan_tag_present) {
> + protocol = skb->protocol;
> + orig_vlan_tag_present = true;
> + } else {
> + struct vlan_hdr *vlan;
> +
> + vlan = (struct vlan_hdr *)skb->data;
> + protocol = vlan->h_vlan_encapsulated_proto;
> + skb_pull(skb, VLAN_HLEN);
> + skb_reset_network_header(skb);
> + (*vlan_hdr_count)++;
> + }
> + goto again;
What prevents this loop to access data not yet in skb->head ?
skb_header_pointer() (or pskb_may_pull()) seems needed.