[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190430224937.57156-2-parav@mellanox.com>
Date: Tue, 30 Apr 2019 17:49:28 -0500
From: Parav Pandit <parav@...lanox.com>
To: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
kwankhede@...dia.com, alex.williamson@...hat.com
Cc: cjia@...dia.com, parav@...lanox.com
Subject: [PATCHv2 01/10] vfio/mdev: Avoid release parent reference during error path
During mdev parent registration in mdev_register_device(),
if parent device is duplicate, it releases the reference of existing
parent device.
This is incorrect. Existing parent device should not be touched.
Fixes: 7b96953bc640 ("vfio: Mediated device Core driver")
Reviewed-by: Cornelia Huck <cohuck@...hat.com>
Reviewed By: Kirti Wankhede <kwankhede@...dia.com>
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Signed-off-by: Parav Pandit <parav@...lanox.com>
---
drivers/vfio/mdev/mdev_core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
index b96fedc77ee5..1299d2e72ce2 100644
--- a/drivers/vfio/mdev/mdev_core.c
+++ b/drivers/vfio/mdev/mdev_core.c
@@ -181,6 +181,7 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
/* Check for duplicate */
parent = __find_parent_device(dev);
if (parent) {
+ parent = NULL;
ret = -EEXIST;
goto add_dev_err;
}
--
2.19.2
Powered by blists - more mailing lists