[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEP_g=_eWXuR_3zUYsbBiAjaCJQjRpSmUypqpJe5_jwN=rmM0Q@mail.gmail.com>
Date: Fri, 22 Feb 2013 17:05:01 -0800
From: Jesse Gross <jesse@...ira.com>
To: Cong Wang <amwang@...hat.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 2/2] vlan: adjust vlan_set_encap_proto() for its callers
On Fri, Feb 22, 2013 at 1:32 AM, Cong Wang <amwang@...hat.com> wrote:
> From: Cong Wang <amwang@...hat.com>
>
> There are two places to call vlan_set_encap_proto():
> vlan_untag() and __pop_vlan_tci().
>
> vlan_untag() assumes skb->data points after mac addr, otherwise
> the following code
>
> vhdr = (struct vlan_hdr *) skb->data;
> vlan_tci = ntohs(vhdr->h_vlan_TCI);
> __vlan_hwaccel_put_tag(skb, vlan_tci);
>
> skb_pull_rcsum(skb, VLAN_HLEN);
>
> won't be correct. But __pop_vlan_tci() assumes points _before_
> mac addr.
>
> In vlan_set_encap_proto(), it looks for some magic L2 value
> after mac addr:
>
> rawp = skb->data;
> if (*(unsigned short *) rawp == 0xFFFF)
> ...
>
> Therefore __pop_vlan_tci() is obviously wrong.
>
> A quick fix is avoiding using skb->data in vlan_set_encap_proto(),
> use 'vhdr+1' is always correct in both cases.
>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: Jesse Gross <jesse@...ira.com>
> Signed-off-by: Cong Wang <amwang@...hat.com>
Acked-by: Jesse Gross <jesse@...ira.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists