On 3/23/2019 4:50 AM, Parav Pandit wrote:
> 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")
> Signed-off-by: Parav Pandit <[email protected]>
> ---
> 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 3e5880a..4f213e4d 100644
> --- a/drivers/vfio/mdev/mdev_core.c
> +++ b/drivers/vfio/mdev/mdev_core.c
> @@ -182,6 +182,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;
> }
>
Agreed. Thanks for fixing this.
Reviewed By: Kirti Wankhede <[email protected]>
Thanks,
Kirti
- Re: [PATCH 3/8] vfio/mdev: Removed unused kref Maxim Levitsky
- Re: [PATCH 3/8] vfio/mdev: Removed unused kref Kirti Wankhede
- [PATCH 8/8] vfio/mdev: Improve the create/remove sequence Parav Pandit
- Re: [PATCH 8/8] vfio/mdev: Improve the create/remove ... Maxim Levitsky
- [PATCH 7/8] vfio/mdev: Fix aborting mdev child device remo... Parav Pandit
- Re: [PATCH 7/8] vfio/mdev: Fix aborting mdev child de... Maxim Levitsky
- Re: [PATCH 7/8] vfio/mdev: Fix aborting mdev child de... Kirti Wankhede
- Re: [PATCH 7/8] vfio/mdev: Fix aborting mdev chil... Alex Williamson
- [PATCH 2/8] vfio/mdev: Avoid release parent reference duri... Parav Pandit
- Re: [PATCH 2/8] vfio/mdev: Avoid release parent refer... Maxim Levitsky
- Re: [PATCH 2/8] vfio/mdev: Avoid release parent refer... Kirti Wankhede
- [PATCH 5/8] vfio/mdev: Avoid masking error code to EBUSY Parav Pandit
- Re: [PATCH 5/8] vfio/mdev: Avoid masking error code t... Maxim Levitsky
- Re: [PATCH 5/8] vfio/mdev: Avoid masking error code t... Kirti Wankhede
- RE: [PATCH 5/8] vfio/mdev: Avoid masking error co... Parav Pandit
- [PATCH 1/8] vfio/mdev: Fix to not do put_device on device_... Parav Pandit
- Re: [PATCH 1/8] vfio/mdev: Fix to not do put_device o... Maxim Levitsky
- Re: [PATCH 1/8] vfio/mdev: Fix to not do put_device o... Kirti Wankhede
- Re: [PATCH 1/8] vfio/mdev: Fix to not do put_devi... Alex Williamson
- RE: [PATCH 1/8] vfio/mdev: Fix to not do put_... Parav Pandit

