netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] OVS: Ignore negative headroom value
@ 2016-08-02 23:56 Ian Wienand
  2016-08-03  0:10 ` kbuild test robot
  2016-08-03  5:44 ` [PATCH net v2] " Ian Wienand
  0 siblings, 2 replies; 4+ messages in thread
From: Ian Wienand @ 2016-08-02 23:56 UTC (permalink / raw)
  To: netdev; +Cc: Benjamin Poirier, Paolo Abeni

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] OVS: Ignore negative headroom value
  2016-08-02 23:56 [PATCH net] OVS: Ignore negative headroom value Ian Wienand
@ 2016-08-03  0:10 ` kbuild test robot
  2016-08-03  0:29   ` Ian Wienand
  2016-08-03  5:44 ` [PATCH net v2] " Ian Wienand
  1 sibling, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2016-08-03  0:10 UTC (permalink / raw)
  To: Ian Wienand; +Cc: kbuild-all, netdev, Benjamin Poirier, Paolo Abeni

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

Hi Ian,

[auto build test ERROR on net/master]

url:    https://github.com/0day-ci/linux/commits/Ian-Wienand/OVS-Ignore-negative-headroom-value/20160803-075826
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   net/openvswitch/vport-internal_dev.c: In function 'internal_set_rx_headroom':
>> net/openvswitch/vport-internal_dev.c:143:25: error: 'new_hdr' undeclared (first use in this function)
     dev->needed_headroom = new_hdr < 0 ? 0 : new_hr;
                            ^
   net/openvswitch/vport-internal_dev.c:143:25: note: each undeclared identifier is reported only once for each function it appears in

vim +/new_hdr +143 net/openvswitch/vport-internal_dev.c

   137	
   138		return stats;
   139	}
   140	
   141	static void internal_set_rx_headroom(struct net_device *dev, int new_hr)
   142	{
 > 143		dev->needed_headroom = new_hdr < 0 ? 0 : new_hr;
   144	}
   145	
   146	static const struct net_device_ops internal_dev_netdev_ops = {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45780 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] OVS: Ignore negative headroom value
  2016-08-03  0:10 ` kbuild test robot
@ 2016-08-03  0:29   ` Ian Wienand
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Wienand @ 2016-08-03  0:29 UTC (permalink / raw)
  Cc: netdev, Benjamin Poirier, Paolo Abeni

On 08/03/2016 10:10 AM, kbuild test robot wrote:
> [auto build test ERROR on net/master]

Sorry, typo.  Thank you test robot

===

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
(drivers/net/tun.c:tun_set_headroom and
drivers/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..95c3614 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_hr < 0 ? 0 : new_hr;
  }

  static const struct net_device_ops internal_dev_netdev_ops = {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net v2] OVS: Ignore negative headroom value
  2016-08-02 23:56 [PATCH net] OVS: Ignore negative headroom value Ian Wienand
  2016-08-03  0:10 ` kbuild test robot
@ 2016-08-03  5:44 ` Ian Wienand
  1 sibling, 0 replies; 4+ messages in thread
From: Ian Wienand @ 2016-08-03  5:44 UTC (permalink / raw)
  To: netdev; +Cc: Ian Wienand, Benjamin Poirier, Paolo Abeni

net_device->ndo_set_rx_headroom (introduced in
871b642adebe300be2e50aa5f65a418510f636ec) says

  "Setting a negtaive 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
(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=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..95c3614 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_hr < 0 ? 0 : new_hr;
 }
 
 static const struct net_device_ops internal_dev_netdev_ops = {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-03  6:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02 23:56 [PATCH net] OVS: Ignore negative headroom value Ian Wienand
2016-08-03  0:10 ` kbuild test robot
2016-08-03  0:29   ` Ian Wienand
2016-08-03  5:44 ` [PATCH net v2] " Ian Wienand

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).