Commit f15650b7 authored by Jan Beulich's avatar Jan Beulich Committed by David S. Miller

netback: don't store invalid vif pointer

When xenvif_alloc() fails, it returns a non-NULL error indicator. To
avoid eventual races, we shouldn't store that into struct backend_info
as readers of it only check for NULL.
Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
Acked-by: default avatarIan Campbell <ian.campbell@citrix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ceaca9dc
...@@ -404,6 +404,7 @@ static int backend_create_xenvif(struct backend_info *be) ...@@ -404,6 +404,7 @@ static int backend_create_xenvif(struct backend_info *be)
int err; int err;
long handle; long handle;
struct xenbus_device *dev = be->dev; struct xenbus_device *dev = be->dev;
struct xenvif *vif;
if (be->vif != NULL) if (be->vif != NULL)
return 0; return 0;
...@@ -414,13 +415,13 @@ static int backend_create_xenvif(struct backend_info *be) ...@@ -414,13 +415,13 @@ static int backend_create_xenvif(struct backend_info *be)
return (err < 0) ? err : -EINVAL; return (err < 0) ? err : -EINVAL;
} }
be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle);
if (IS_ERR(be->vif)) { if (IS_ERR(vif)) {
err = PTR_ERR(be->vif); err = PTR_ERR(vif);
be->vif = NULL;
xenbus_dev_fatal(dev, err, "creating interface"); xenbus_dev_fatal(dev, err, "creating interface");
return err; return err;
} }
be->vif = vif;
kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment