[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH xen/stable-2.6.32.x] fix ethtool_get_drvinfo NULL pointer dereference


  • To: M A Young <m.a.young@xxxxxxxxxxxx>
  • From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
  • Date: Fri, 03 Dec 2010 21:48:34 +0100
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
  • Delivery-date: Fri, 03 Dec 2010 12:49:30 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=kPPNA25t6/3h9CecfSYxR9hglvbku2U7s2GOjDfOqLyn9ed0fflba03yo2d8p6TYnf peu9Mpy/g+or+yxZdQ7SPAX75ymT7m4yNOQCNwpNKQEDzRb4vaVIoWcMbY0d3icIqI8I mBrPFXMOj3xNNB7HJBd3dCNvCj6hWFbFySaMI=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Fixes the following crash on "ethtool -i":

BUG: unable to handle kernel NULL pointer dereference at 0000000000000148
IP: [<ffffffff813bcfe2>] ethtool_get_drvinfo+0x106/0x1a5
PGD d8040067 PUD d8041067 PMD 0
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1c.0/0000:09:00.0/irq 
...
Call Trace:
[<ffffffff813bd298>] dev_ethtool+0x93/0x1153
[<ffffffff810dd957>] ? __alloc_pages_nodemask+0x122/0x62d
[<ffffffff810dd957>] ? __alloc_pages_nodemask+0x122/0x62d
[<ffffffff811ee21e>] ? avc_has_perm+0x5c/0x6e
[<ffffffff811158ad>] ? try_get_mem_cgroup_from_mm+0x39/0x49 
...
RIP  [<ffffffff813bcfe2>] ethtool_get_drvinfo+0x106/0x1a5 

The backport of 01414802 was incomplete.  This is the patch we are
using in RHEL6.

Reported-by: M A Young <m.a.young@xxxxxxxxxxxx>
Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
 ethtool.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index ff35ce3..8ca3a26 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -211,9 +211,9 @@ static int ethtool_get_drvinfo(struct net_device *dev, void 
__user *useraddr)
        } else {
                /* code path for obsolete hooks */
 
-               if (ops->self_test_count)
+               if (ops && ops->self_test_count)
                        info.testinfo_len = ops->self_test_count(dev);
-               if (ops->get_stats_count)
+               if (ops && ops->get_stats_count)
                        info.n_stats = ops->get_stats_count(dev);
        }
        if (ops && ops->get_regs_len)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.