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

[PATCH] xen/xenbus: handle potential dangling pointer issue in xen_pcibk_xenbus_probe



From: Yunseong Kim <yskelg@xxxxxxxxx>

If 'xen_pcibk_init_devices()' fails. This ensures that 'pdev->xdev' does
not point to 'xdev' when 'pdev' is freed.

Signed-off-by: Yunseong Kim <yskelg@xxxxxxxxx>
---
 drivers/xen/xen-pciback/xenbus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index b11e401f1b1e..348d6803b8c0 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -54,6 +54,7 @@ static struct xen_pcibk_device *alloc_pdev(struct 
xenbus_device *xdev)
        INIT_WORK(&pdev->op_work, xen_pcibk_do_op);
 
        if (xen_pcibk_init_devices(pdev)) {
+               pdev->xdev = NULL;
                kfree(pdev);
                pdev = NULL;
        }
-- 
2.34.1




 


Rackspace

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