diff options
| author | Alex Williamson <alex.williamson@redhat.com> | 2013-04-30 17:42:28 -0400 |
|---|---|---|
| committer | Alex Williamson <alex.williamson@redhat.com> | 2013-04-30 17:42:28 -0400 |
| commit | 664e9386bd05dbdfecfb28d6cf2fde983aabc65c (patch) | |
| tree | 3981446d435ccf0c74f59520c1024ea51b41fcfe | |
| parent | 0b43c082338b857c27d2f87c886eb78812ccd236 (diff) | |
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>
| -rw-r--r-- | drivers/vfio/vfio.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index ac7423bfaa7d..acb7121a9316 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/rwsem.h> | 27 | #include <linux/rwsem.h> |
| 28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | #include <linux/stat.h> | ||
| 30 | #include <linux/string.h> | 31 | #include <linux/string.h> |
| 31 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
| 32 | #include <linux/vfio.h> | 33 | #include <linux/vfio.h> |
| @@ -1359,6 +1360,9 @@ static const struct file_operations vfio_device_fops = { | |||
| 1359 | */ | 1360 | */ |
| 1360 | static char *vfio_devnode(struct device *dev, umode_t *mode) | 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 | return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev)); | 1366 | return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev)); |
| 1363 | } | 1367 | } |
| 1364 | 1368 | ||
