]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
net/sched: act_vlan: Push skb->data to mac_header prior calling skb_vlan_*() functions
authorShmulik Ladkani <shmulik.ladkani@gmail.com>
Thu, 29 Sep 2016 09:10:40 +0000 (12:10 +0300)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 6 Dec 2016 16:52:20 +0000 (16:52 +0000)
commit4d3ba830521d1874469479baa6ea05bd64567063
treed775f0ddcc8e672981bda5faa13e790e48b8662c
parent8822b5321bea7a5340c07764bcbcf599606510a7
net/sched: act_vlan: Push skb->data to mac_header prior calling skb_vlan_*() functions

BugLink: http://bugs.launchpad.net/bugs/1642573
[ Upstream commit f39acc84aad10710e89835c60d3b6694c43a8dd9 ]

Generic skb_vlan_push/skb_vlan_pop functions don't properly handle the
case where the input skb data pointer does not point at the mac header:

- They're doing push/pop, but fail to properly unwind data back to its
  original location.
  For example, in the skb_vlan_push case, any subsequent
  'skb_push(skb, skb->mac_len)' calls make the skb->data point 4 bytes
  BEFORE start of frame, leading to bogus frames that may be transmitted.

- They update rcsum per the added/removed 4 bytes tag.
  Alas if data is originally after the vlan/eth headers, then these
  bytes were already pulled out of the csum.

OTOH calling skb_vlan_push/skb_vlan_pop with skb->data at mac_header
present no issues.

act_vlan is the only caller to skb_vlan_*() that has skb->data pointing
at network header (upon ingress).
Other calles (ovs, bpf) already adjust skb->data at mac_header.

This patch fixes act_vlan to point to the mac_header prior calling
skb_vlan_*() functions, as other callers do.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Pravin Shelar <pshelar@ovn.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
include/net/sch_generic.h
net/sched/act_vlan.c