vfio: Use anon_inode_getfile_fmode() in vfio_device_open_file()
Subsystems (2)
PATCH 1/1 vfio: Use anon_inode_getfile_fmode() in vfio_device_open_file()
Remove TODO by using the anon_inode_getfile_fmode() instead of setting the fmode directly in vfio_device_open_file().
Signed-off-by Dawid Osuchowski <[email protected]>
---
Depends on [1]
[1] https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u
--- drivers/vfio/group.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/vfio/group.c +3 -10
@@ -270,22 +270,15 @@ static struct file *vfio_device_open_file(struct vfio_device *device)/* * We can't use anon_inode_getfd() because we need to modify -* the f_mode flags directly to allow more than just ioctls +* the f_mode flags to allow more than just ioctls */ - filep =anon_inode_getfile ("[vfio-device]" , &vfio_device_fops, - df,O_RDWR ); + filep =anon_inode_getfile_fmode ("[vfio-device]" , &vfio_device_fops, + df,O_RDWR ,FMODE_PREAD |FMODE_PWRITE );if (IS_ERR (filep)) { ret =PTR_ERR (filep); goto err_close_device; } -/* -* TODO: add an anon_inode interface to do this. -* Appears to be missing by lack of need rather than -* explicitly prevented. Now there's need. -*/ - filep->f_mode |= (FMODE_PREAD |FMODE_PWRITE ); -if (device->group->type ==VFIO_NO_IOMMU )dev_warn (device->dev,"vfio-noiommu device opened by user " "(%s:%d)\n" , current->comm,task_pid_nr (current));
Signature · 1 line
2.44.0
Quoted 6 lines
From: Dawid Osuchowski <[email protected]>
Sent: Thursday, April 25, 2024 7:42 AMRemove TODO by using the
anon_inode_getfile_fmode()instead of setting the fmode directly invfio_device_open_file().
Quoted 6 lines
Signed-off-by Dawid Osuchowski <[email protected]>---
Depends on [1][1] https://lore.kernel.org/linux-fsdevel/20240424233859.7640-1-
[email protected]/T/#u
Reviewed-by Kevin Tian <[email protected]>