Re: [PATCH net-next 08/19] vfio/mdev: Make mdev alias unique among all mdevs

Jiri Pirko
2019-11-08T10:49:59Z

Thu, Nov 07, 2019 at 05:08:23PM CET, parav@mellanox.com wrote:
>Mdev alias should be unique among all the mdevs, so that when such alias
>is used by the mdev users to derive other objects, there is no
>collision in a given system.
>
>Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
>Signed-off-by: Parav Pandit <parav@mellanox.com>
>---
> drivers/vfio/mdev/mdev_core.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
>index 3bdff0469607..c8cd40366783 100644
>--- a/drivers/vfio/mdev/mdev_core.c
>+++ b/drivers/vfio/mdev/mdev_core.c
>@@ -388,6 +388,13 @@ int mdev_device_create(struct kobject *kobj, struct device *dev,
> ret = -EEXIST;
> goto mdev_fail;
> }
>+ if (alias && tmp->alias && !strcmp(alias, tmp->alias)) {
>+ mutex_unlock(&mdev_list_lock);
>+ ret = -EEXIST;
>+ dev_dbg_ratelimited(dev, "Hash collision in alias creation for UUID %pUl\n",
>+ uuid);
>+ goto mdev_fail;
>+ }

I don't understand why this needs to be a separate patch. This check
seems to be an inseparable part of mdev alias feature.
Please squash to the previous patch.

> }
>
> mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
>--
>2.19.2
>