WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: M A Young <m.a.young@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH xen/stable-2.6.32.x] fix ethtool_get_drvinfo NULL pointer dereference
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
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=SkalJWnANSqEOy7sIP1U6KMRmi7PJXHv94w7eOYoE6w=; b=c9sl7H5vpgk+cVpBgsCuYDXZTZyUDMVXDgCxzeRHSz2eaMYKEkUy7UA6iAR8oxXzqX c0QV0M47Tgdqv4dvhs/Mo5E51JnAgh+AEKOa+juaiZ2uz3gtXo7dxZNAESlm0JBdmGFC yyOqBMlNhSc4/l1uaKhCIyv8D5ktZGKojEdJw=
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=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.LFD.2.00.1012031542380.26112@xxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.LFD.2.00.1012031542380.26112@xxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6
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

<Prev in Thread] Current Thread [Next in Thread>