aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio/mdev/mdev_core.c
diff options
context:
space:
mode:
authorJason Gunthorpe <[email protected]>2022-04-11 14:14:02 +0000
committerZhi Wang <[email protected]>2022-04-21 11:36:56 +0000
commit2aa72ec97ce9eb092cb69efd26f5eb2469e61734 (patch)
treef66d01ba6f0288d269e0614794f35c8d92301e87 /drivers/vfio/mdev/mdev_core.c
parentvfio/mdev: Remove mdev_parent_ops (diff)
downloadkernel-2aa72ec97ce9eb092cb69efd26f5eb2469e61734.tar.gz
kernel-2aa72ec97ce9eb092cb69efd26f5eb2469e61734.zip
vfio/mdev: Use the driver core to create the 'remove' file
The device creator is supposed to use the dev.groups value to add sysfs files before device_add is called, not call sysfs_create_files() after device_add() returns. This creates a race with uevent delivery where the extra attribute will not be visible. This was being done because the groups had been co-opted by the mdev driver, now that prior patches have moved the driver's groups to the struct device_driver the dev.group is properly free for use here. Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Zhi Wang <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Kirti Wankhede <[email protected]> Reviewed-by: Zhi Wang <[email protected]>
Diffstat (limited to 'drivers/vfio/mdev/mdev_core.c')
-rw-r--r--drivers/vfio/mdev/mdev_core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
index 19a20ff420b7..b8b9e7911e55 100644
--- a/drivers/vfio/mdev/mdev_core.c
+++ b/drivers/vfio/mdev/mdev_core.c
@@ -269,6 +269,7 @@ int mdev_device_create(struct mdev_type *type, const guid_t *uuid)
mdev->dev.parent = parent->dev;
mdev->dev.bus = &mdev_bus_type;
mdev->dev.release = mdev_device_release;
+ mdev->dev.groups = mdev_device_groups;
mdev->type = type;
/* Pairs with the put in mdev_device_release() */
kobject_get(&type->kobj);