linux/include
Cong Wang da8c87241c vlan: adjust vlan_set_encap_proto() for its callers
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@davemloft.net>
Cc: Jesse Gross <jesse@nicira.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-02-23 21:00:06 -05:00
..
acpi Merge branch 'acpi-cleanup' 2013-02-15 13:58:30 +01:00
asm-generic The common clock framework changes for 3.9 are almost entirely fixes. 2013-02-20 11:02:10 -08:00
clocksource
crypto
drm Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel 2013-01-11 07:52:48 +10:00
keys
linux vlan: adjust vlan_set_encap_proto() for its callers 2013-02-23 21:00:06 -05:00
math-emu
media
memory
misc
net net: fix possible deadlock in sum_frag_mem_limit 2013-02-22 15:10:19 -05:00
pcmcia
ras
rdma UAPI: Remove empty Kbuild files 2013-01-02 17:36:10 -08:00
rxrpc
scsi
sound Merge remote-tracking branch 'asoc/fix/cs4271' into tmp 2013-01-10 12:22:11 +00:00
target target: Introduce TCM_NO_SENSE 2013-01-10 20:06:08 -08:00
trace ACPI and power management updates for 3.9-rc1 2013-02-20 11:26:56 -08:00
uapi Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-02-20 18:58:50 -08:00
video
xen
Kbuild UAPI: Remove empty Kbuild files 2013-01-02 17:36:10 -08:00