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: Bastian Blank <waldi@xxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>, James Harper <james.harper@xxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xen/netback: Fix null-pointer access in netback_uevent
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Thu, 29 Jul 2010 08:40:30 -0700
Cc:
Delivery-date: Thu, 29 Jul 2010 08:41:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100729153018.GA12495@xxxxxxxxxxxxxxxxxxxxxxx>
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: <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> <20100729153018.GA12495@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.1
 On 07/29/2010 08:30 AM, Bastian Blank wrote:
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.

OK, I'll stick it in.  Do you have a complete commit comment?

Thanks,
    J
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;



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