[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191107160834.21087-8-parav@mellanox.com>
Date: Thu, 7 Nov 2019 10:08:23 -0600
From: Parav Pandit <parav@...lanox.com>
To: alex.williamson@...hat.com, davem@...emloft.net,
kvm@...r.kernel.org, netdev@...r.kernel.org
Cc: saeedm@...lanox.com, kwankhede@...dia.com, leon@...nel.org,
cohuck@...hat.com, jiri@...lanox.com, linux-rdma@...r.kernel.org,
Parav Pandit <parav@...lanox.com>
Subject: [PATCH net-next 08/19] vfio/mdev: Make mdev alias unique among all mdevs
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@...lanox.com>
Signed-off-by: Parav Pandit <parav@...lanox.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;
+ }
}
mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
--
2.19.2
Powered by blists - more mailing lists