All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-pciback: fix up cleanup path when alloc fails
@ 2015-11-26 20:32 Doug Goldstein
  2015-11-30 21:09 ` Boris Ostrovsky
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Doug Goldstein @ 2015-11-26 20:32 UTC (permalink / raw)
  To: xen-devel
  Cc: linux-kernel, Bob Liu, Paul Durrant, Wei Liu, David Vrabel,
	Boris Ostrovsky, Konrad Rzeszutek Wilk, Jonathan Creekmore,
	Doug Goldstein

When allocating a pciback device fails, avoid the possibility of a
use after free.

Reported-by: Jonathan Creekmore <jonathan.creekmore@gmail.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 drivers/xen/xen-pciback/xenbus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 98bc345..4843741 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -44,7 +44,6 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)
 	dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev);
 
 	pdev->xdev = xdev;
-	dev_set_drvdata(&xdev->dev, pdev);
 
 	mutex_init(&pdev->dev_lock);
 
@@ -58,6 +57,9 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)
 		kfree(pdev);
 		pdev = NULL;
 	}
+
+	dev_set_drvdata(&xdev->dev, pdev);
+
 out:
 	return pdev;
 }
-- 
2.4.10


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [PATCH] xen-pciback: fix up cleanup path when alloc fails
@ 2015-11-26 20:32 Doug Goldstein
  0 siblings, 0 replies; 18+ messages in thread
From: Doug Goldstein @ 2015-11-26 20:32 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Jonathan Creekmore, Doug Goldstein, linux-kernel,
	Paul Durrant, David Vrabel, Boris Ostrovsky

When allocating a pciback device fails, avoid the possibility of a
use after free.

Reported-by: Jonathan Creekmore <jonathan.creekmore@gmail.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 drivers/xen/xen-pciback/xenbus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 98bc345..4843741 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -44,7 +44,6 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)
 	dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev);
 
 	pdev->xdev = xdev;
-	dev_set_drvdata(&xdev->dev, pdev);
 
 	mutex_init(&pdev->dev_lock);
 
@@ -58,6 +57,9 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)
 		kfree(pdev);
 		pdev = NULL;
 	}
+
+	dev_set_drvdata(&xdev->dev, pdev);
+
 out:
 	return pdev;
 }
-- 
2.4.10

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-12-14 20:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-26 20:32 [PATCH] xen-pciback: fix up cleanup path when alloc fails Doug Goldstein
2015-11-30 21:09 ` Boris Ostrovsky
2015-11-30 21:09 ` Boris Ostrovsky
2015-12-01 16:47 ` Konrad Rzeszutek Wilk
2015-12-01 19:24   ` Doug Goldstein
2015-12-01 19:24   ` Doug Goldstein
2015-12-01 19:35   ` Konrad Rzeszutek Wilk
2015-12-01 20:54     ` Doug Goldstein
2015-12-01 21:34       ` Konrad Rzeszutek Wilk
2015-12-01 20:54     ` Doug Goldstein
2015-12-02 10:35 ` David Vrabel
2015-12-02 10:35 ` David Vrabel
2015-12-02 14:56   ` Doug Goldstein
2015-12-02 14:56   ` Doug Goldstein
2015-12-14 16:08     ` David Vrabel
2015-12-14 16:08     ` [Xen-devel] " David Vrabel
2015-12-14 20:21       ` Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2015-11-26 20:32 Doug Goldstein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.