Commit 5ef9f289 authored by Ian Wienand's avatar Ian Wienand Committed by David S. Miller

OVS: Ignore negative headroom value

net_device->ndo_set_rx_headroom (introduced in
871b642a) says

  "Setting a negtaive value reset the rx headroom
   to the default value".

It seems that the OVS implementation in
3a927bc7 overlooked this and sets
dev->needed_headroom unconditionally.

This doesn't have an immediate effect, but can mess up later
LL_RESERVED_SPACE calculations, such as done in
net/ipv6/mcast.c:mld_newpack.  For reference, this issue was found
from a skb_panic raised there after the length calculations had given
the wrong result.

Note the other current users of this interface
(drivers/net/tun.c:tun_set_headroom and
drivers/net/veth.c:veth_set_rx_headroom) are both checking this
correctly thus need no modification.

Thanks to Ben for some pointers from the crash dumps!

Cc: Benjamin Poirier <bpoirier@suse.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1361414Signed-off-by: default avatarIan Wienand <iwienand@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7cf210dc
...@@ -140,7 +140,7 @@ internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) ...@@ -140,7 +140,7 @@ internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
static void internal_set_rx_headroom(struct net_device *dev, int new_hr) static void internal_set_rx_headroom(struct net_device *dev, int new_hr)
{ {
dev->needed_headroom = new_hr; dev->needed_headroom = new_hr < 0 ? 0 : new_hr;
} }
static const struct net_device_ops internal_dev_netdev_ops = { static const struct net_device_ops internal_dev_netdev_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment