744edb7
From 5ef9f289c4e698054e5687edb54f0da3cdc9173a Mon Sep 17 00:00:00 2001
744edb7
From: Ian Wienand <iwienand@redhat.com>
744edb7
Date: Wed, 3 Aug 2016 15:44:57 +1000
744edb7
Subject: OVS: Ignore negative headroom value
744edb7
744edb7
net_device->ndo_set_rx_headroom (introduced in
744edb7
871b642adebe300be2e50aa5f65a418510f636ec) says
744edb7
744edb7
  "Setting a negtaive value reset the rx headroom
744edb7
   to the default value".
744edb7
744edb7
It seems that the OVS implementation in
744edb7
3a927bc7cf9d0fbe8f4a8189dd5f8440228f64e7 overlooked this and sets
744edb7
dev->needed_headroom unconditionally.
744edb7
744edb7
This doesn't have an immediate effect, but can mess up later
744edb7
LL_RESERVED_SPACE calculations, such as done in
744edb7
net/ipv6/mcast.c:mld_newpack.  For reference, this issue was found
744edb7
from a skb_panic raised there after the length calculations had given
744edb7
the wrong result.
744edb7
744edb7
Note the other current users of this interface
744edb7
(drivers/net/tun.c:tun_set_headroom and
744edb7
drivers/net/veth.c:veth_set_rx_headroom) are both checking this
744edb7
correctly thus need no modification.
744edb7
744edb7
Thanks to Ben for some pointers from the crash dumps!
744edb7
744edb7
Cc: Benjamin Poirier <bpoirier@suse.com>
744edb7
Cc: Paolo Abeni <pabeni@redhat.com>
744edb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1361414
744edb7
Signed-off-by: Ian Wienand <iwienand@redhat.com>
744edb7
Signed-off-by: David S. Miller <davem@davemloft.net>
744edb7
---
744edb7
 net/openvswitch/vport-internal_dev.c | 2 +-
744edb7
 1 file changed, 1 insertion(+), 1 deletion(-)
744edb7
744edb7
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
744edb7
index 434e04c..95c3614 100644
744edb7
--- a/net/openvswitch/vport-internal_dev.c
744edb7
+++ b/net/openvswitch/vport-internal_dev.c
744edb7
@@ -140,7 +140,7 @@ internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
744edb7
 
744edb7
 static void internal_set_rx_headroom(struct net_device *dev, int new_hr)
744edb7
 {
744edb7
-	dev->needed_headroom = new_hr;
744edb7
+	dev->needed_headroom = new_hr < 0 ? 0 : new_hr;
744edb7
 }
744edb7
 
744edb7
 static const struct net_device_ops internal_dev_netdev_ops = {
744edb7
-- 
744edb7
cgit v0.12
744edb7