mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
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: 7b96953bc6
("vfio: Mediated device Core driver")
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
2c85f2bd51
commit
60e7f2c3fe
1 changed files with 1 additions and 0 deletions
|
@ -181,6 +181,7 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
|
||||||
/* Check for duplicate */
|
/* Check for duplicate */
|
||||||
parent = __find_parent_device(dev);
|
parent = __find_parent_device(dev);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
parent = NULL;
|
||||||
ret = -EEXIST;
|
ret = -EEXIST;
|
||||||
goto add_dev_err;
|
goto add_dev_err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue