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

[Xen-changelog] [linux-2.6.18-xen] netback: don't store invalid netif pointer


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Wed, 10 Dec 2014 09:33:02 +0000
  • Delivery-date: Wed, 10 Dec 2014 09:33:12 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1418203133 -3600
# Node ID c21bd91c271348bd589fd2519139cc2816c1d26f
# Parent  e8c8784ca274e2200c1b4ab9b41912acce1f33ae
netback: don't store invalid netif pointer

When netif_alloc() fails, it returns a non-NULL error indicator. We
shouldn't store that into struct backend_info as readers of it only
check for NULL.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r e8c8784ca274 -r c21bd91c2713 drivers/xen/netback/xenbus.c
--- a/drivers/xen/netback/xenbus.c      Tue Dec 02 12:43:21 2014 +0100
+++ b/drivers/xen/netback/xenbus.c      Wed Dec 10 10:18:53 2014 +0100
@@ -193,6 +193,7 @@ static void backend_create_netif(struct 
        int err;
        long handle;
        struct xenbus_device *dev = be->dev;
+       netif_t *netif;
 
        if (be->netif != NULL)
                return;
@@ -203,13 +204,13 @@ static void backend_create_netif(struct 
                return;
        }
 
-       be->netif = netif_alloc(&dev->dev, dev->otherend_id, handle);
-       if (IS_ERR(be->netif)) {
-               err = PTR_ERR(be->netif);
-               be->netif = NULL;
+       netif = netif_alloc(&dev->dev, dev->otherend_id, handle);
+       if (IS_ERR(netif)) {
+               err = PTR_ERR(netif);
                xenbus_dev_fatal(dev, err, "creating interface");
                return;
        }
+       be->netif = netif;
 
        kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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