51 lines
1.6 KiB
Diff
51 lines
1.6 KiB
Diff
From e67d8dd0e2c1b8b4573a6a3f05f609be230dfaff Mon Sep 17 00:00:00 2001
|
|
From: Jan Beulich <JBeulich@suse.com>
|
|
Date: Tue, 9 Dec 2014 11:47:04 +0000
|
|
Subject: [PATCH 3/4] netback: don't store invalid vif pointer
|
|
Origin: https://git.kernel.org/linus/f15650b7f94879667f253bc32de7431c1baf2d6e
|
|
|
|
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: Jan Beulich <jbeulich@suse.com>
|
|
Acked-by: Ian Campbell <ian.campbell@citrix.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
drivers/net/xen-netback/xenbus.c | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
|
|
index 0b4f1c7..cc8f8ba 100644
|
|
--- a/drivers/net/xen-netback/xenbus.c
|
|
+++ b/drivers/net/xen-netback/xenbus.c
|
|
@@ -404,6 +404,7 @@ static int backend_create_xenvif(struct backend_info *be)
|
|
int err;
|
|
long handle;
|
|
struct xenbus_device *dev = be->dev;
|
|
+ struct xenvif *vif;
|
|
|
|
if (be->vif != NULL)
|
|
return 0;
|
|
@@ -414,13 +415,13 @@ static int backend_create_xenvif(struct backend_info *be)
|
|
return (err < 0) ? err : -EINVAL;
|
|
}
|
|
|
|
- be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle);
|
|
- if (IS_ERR(be->vif)) {
|
|
- err = PTR_ERR(be->vif);
|
|
- be->vif = NULL;
|
|
+ vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle);
|
|
+ if (IS_ERR(vif)) {
|
|
+ err = PTR_ERR(vif);
|
|
xenbus_dev_fatal(dev, err, "creating interface");
|
|
return err;
|
|
}
|
|
+ be->vif = vif;
|
|
|
|
kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
|
|
return 0;
|
|
--
|
|
1.7.10.4
|
|
|