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

Re: [Xen-devel] [PATCH] xen/netback: Fix null-pointer access in netback_

To: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xen/netback: Fix null-pointer access in netback_uevent
From: Bastian Blank <waldi@xxxxxxxxxx>
Date: Thu, 29 Jul 2010 17:30:18 +0200
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, James Harper <james.harper@xxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Thu, 29 Jul 2010 08:32:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1280411076.24292.1841.camel@xxxxxxxxxxxxxxxxxxxxxx>
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>
Mail-followup-to: Bastian Blank <waldi@xxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, James Harper <james.harper@xxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
References: <4C005228.5060107@xxxxxxxx> <AEC6C66638C05B468B556EA548C1A77D01996C20@trantor> <20100529064411.GA12168@xxxxxxxxxxxxxxxxxxxxxxx> <20100529184452.GA18365@xxxxxxxxxxxxxxxxxxxxxxx> <4C0383670200007800004B63@xxxxxxxxxxxxxxxxxx> <4C038A480200007800004B80@xxxxxxxxxxxxxxxxxx> <20100728162001.GA21304@xxxxxxxxxxxxxxxxxxxxxxx> <1280404035.24292.1805.camel@xxxxxxxxxxxxxxxxxxxxxx> <20100729124213.GA10008@xxxxxxxxxxxxxxxxxxxxxxx> <1280411076.24292.1841.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
On Thu, Jul 29, 2010 at 02:44:36PM +0100, Ian Campbell wrote:
> On Thu, 2010-07-29 at 13:42 +0100, Bastian Blank wrote:
> > Yes, this is included since 2.6.32-15.
> The patch from <20100529184452.GA18365@xxxxxxxxxxxxxxxxxxxxxxx>?

Currently the following patch is used. The next test should be if it is
really necessary to have this much different structures, a quick look
said: most likely no.

diff --git a/drivers/xen/netback/xenbus.c b/drivers/xen/netback/xenbus.c
index 99831c7..1930f64 100644
--- a/drivers/xen/netback/xenbus.c
+++ b/drivers/xen/netback/xenbus.c
@@ -162,17 +162,11 @@ fail:
  */
 static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env 
*env)
 {
-       struct backend_info *be;
-       struct xen_netif *netif;
+       struct backend_info *be = dev_get_drvdata(&xdev->dev);
        char *val;
 
        DPRINTK("netback_uevent");
 
-       be = dev_get_drvdata(&xdev->dev);
-       if (!be)
-               return 0;
-       netif = be->netif;
-
        val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL);
        if (IS_ERR(val)) {
                int err = PTR_ERR(val);
@@ -187,7 +181,7 @@ static int netback_uevent(struct xenbus_device *xdev, 
struct kobj_uevent_env *en
                kfree(val);
        }
 
-       if (add_uevent_var(env, "vif=%s", netif->dev->name))
+       if (be && be->netif && add_uevent_var(env, "vif=%s", 
be->netif->dev->name))
                return -ENOMEM;
 
        return 0;

-- 
You!  What PLANET is this!
                -- McCoy, "The City on the Edge of Forever", stardate 3134.0

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