Skip to content

Commit 740dbc2

Browse files
joestringerdavem330
authored andcommitted
openvswitch: Scrub skb between namespaces
If OVS receives a packet from another namespace, then the packet should be scrubbed. However, people have already begun to rely on the behaviour that skb->mark is preserved across namespaces, so retain this one field. This is mainly to address information leakage between namespaces when using OVS internal ports, but by placing it in ovs_vport_receive() it is more generally applicable, meaning it should not be overlooked if other port types are allowed to be moved into namespaces in future. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a5d6f7d commit 740dbc2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/openvswitch/vport.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,15 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
444444

445445
OVS_CB(skb)->input_vport = vport;
446446
OVS_CB(skb)->mru = 0;
447+
if (unlikely(dev_net(skb->dev) != ovs_dp_get_net(vport->dp))) {
448+
u32 mark;
449+
450+
mark = skb->mark;
451+
skb_scrub_packet(skb, true);
452+
skb->mark = mark;
453+
tun_info = NULL;
454+
}
455+
447456
/* Extract flow from 'skb' into 'key'. */
448457
error = ovs_flow_key_extract(tun_info, skb, &key);
449458
if (unlikely(error)) {

0 commit comments

Comments
 (0)