diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2025-01-18 01:44:34 +0000 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-02-21 10:25:31 +0100 |
| commit | f9835fa147e6adebd342e88a517c158f6ad20b9a (patch) | |
| tree | 25905eeba3e2329b91aff2c515e30b23beb0c1c0 /drivers | |
| parent | 822c11592522dc00e1f447dbe95350071001d9f1 (diff) | |
make use of anon_inode_getfile_fmode()
["fallen through the cracks" misc stuff]
A bunch of anon_inode_getfile() callers follow it with adjusting
->f_mode; we have a helper doing that now, so let's make use
of it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/20250118014434.GT1977892@ZenIV
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/vfio/group.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c index 49559605177e..c321d442f0da 100644 --- a/drivers/vfio/group.c +++ b/drivers/vfio/group.c @@ -266,24 +266,12 @@ static struct file *vfio_device_open_file(struct vfio_device *device) if (ret) goto err_free; - /* - * We can't use anon_inode_getfd() because we need to modify - * the f_mode flags directly 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); - /* * Use the pseudo fs inode on the device to link all mmaps * to the same address space, allowing us to unmap all vmas |
