Commit 664e9386bd05dbdfecfb28d6cf2fde983aabc65c

Authored by Alex Williamson
1 parent 0b43c08233

vfio: Set container device mode

Minor 0 is the VFIO container device (/dev/vfio/vfio).  On it's own
the container does not provide a user with any privileged access.  It
only supports API version check and extension check ioctls.  Only by
attaching a VFIO group to the container does it gain any access.  Set
the mode of the container to allow access.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff

... ... @@ -27,6 +27,7 @@
27 27 #include <linux/rwsem.h>
28 28 #include <linux/sched.h>
29 29 #include <linux/slab.h>
  30 +#include <linux/stat.h>
30 31 #include <linux/string.h>
31 32 #include <linux/uaccess.h>
32 33 #include <linux/vfio.h>
... ... @@ -1359,6 +1360,9 @@
1359 1360 */
1360 1361 static char *vfio_devnode(struct device *dev, umode_t *mode)
1361 1362 {
  1363 + if (MINOR(dev->devt) == 0)
  1364 + *mode = S_IRUGO | S_IWUGO;
  1365 +
1362 1366 return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev));
1363 1367 }
1364 1368