netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Wienand <iwienand@redhat.com>
To: netdev@vger.kernel.org
Cc: Benjamin Poirier <bpoirier@suse.com>, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net] OVS: Ignore negative headroom value
Date: Wed, 3 Aug 2016 09:56:46 +1000	[thread overview]
Message-ID: <52e102db-a75f-c239-b396-ac2b9860d809@redhat.com> (raw)

Hi,

net_device->ndo_set_rx_headroom (introduced in
871b642adebe300be2e50aa5f65a418510f636ec) says

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

It seems that the OVS implementation in
3a927bc7cf9d0fbe8f4a8189dd5f8440228f64e7 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
(drives/net/tun.c:tun_set_headroom and
drives/net/veth.c:veth_set_rx_headroom) are both checking this
correctly and thus need no modification.

An OpenStack tempest run
(http://docs.openstack.org/developer/tempest/) that reliably hit this
panic works correctly with this patch.  Thanks to Ben for some
pointers from the crash dumps!

Cc: Benjamin Poirier <bpoirier@suse.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1361414
Signed-off-by: Ian Wienand <iwienand@redhat.com>
---
 net/openvswitch/vport-internal_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 434e04c..f294253 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -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)
 {
-	dev->needed_headroom = new_hr;
+	dev->needed_headroom = new_hdr < 0 ? 0 : new_hr;
 }
 
 static const struct net_device_ops internal_dev_netdev_ops = {
-- 
2.7.4

             reply	other threads:[~2016-08-02 23:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 23:56 Ian Wienand [this message]
2016-08-03  0:10 ` [PATCH net] OVS: Ignore negative headroom value kbuild test robot
2016-08-03  0:29   ` Ian Wienand
2016-08-03  5:44 ` [PATCH net v2] " Ian Wienand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52e102db-a75f-c239-b396-ac2b9860d809@redhat.com \
    --to=iwienand@redhat.com \
    --cc=bpoirier@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).