[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] netback: do not report success if backend_create_netif() fails
# HG changeset patch # User Alexey Khoroshilov <khoroshilov@xxxxxxxxx> # Date 1418203359 -3600 # Node ID 078f1bb69ea5e3772f3df4b4ee21f3c52e381e51 # Parent c21bd91c271348bd589fd2519139cc2816c1d26f netback: do not report success if backend_create_netif() fails If netif_alloc() or xenbus_scanf() fail in backend_create_netif(), xenbus is left in offline mode but netback_probe() reports success. The patch implements propagation of error code for backend_create_netif(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@xxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> Adjusted to XenoLinux naming. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Committed-by: Jan Beulich <jbeulich@xxxxxxxx> --- diff -r c21bd91c2713 -r 078f1bb69ea5 drivers/xen/netback/xenbus.c --- a/drivers/xen/netback/xenbus.c Wed Dec 10 10:18:53 2014 +0100 +++ b/drivers/xen/netback/xenbus.c Wed Dec 10 10:22:39 2014 +0100 @@ -31,7 +31,7 @@ static int connect_rings(struct backend_info *); static void connect(struct backend_info *); -static void backend_create_netif(struct backend_info *be); +static int backend_create_netif(struct backend_info *be); static void unregister_hotplug_status_watch(struct backend_info *be); static void netback_disconnect(struct device *); @@ -138,7 +138,9 @@ static int netback_probe(struct xenbus_d goto fail; /* This kicks hotplug scripts, so do it immediately. */ - backend_create_netif(be); + err = backend_create_netif(be); + if (err) + goto fail; return 0; @@ -188,7 +190,7 @@ static int netback_uevent(struct xenbus_ } -static void backend_create_netif(struct backend_info *be) +static int backend_create_netif(struct backend_info *be) { int err; long handle; @@ -196,23 +198,24 @@ static void backend_create_netif(struct netif_t *netif; if (be->netif != NULL) - return; + return 0; err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); if (err != 1) { xenbus_dev_fatal(dev, err, "reading handle"); - return; + return (err < 0) ? err : -EINVAL; } 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; + return err; } be->netif = netif; kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); + return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |