History

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.

Alex Williamson committed 13 years ago

Commit 664e9381 parent 0b43c081 file · +4 −0Browse files

Unified · Split

drivers/vfio/vfio.c+4−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/rwsem.h>
2828 #include <linux/sched.h>
2929 #include <linux/slab.h>
30+#include <linux/stat.h>
3031 #include <linux/string.h>
3132 #include <linux/uaccess.h>
3233 #include <linux/vfio.h>
@@ -1359,6 +1360,9 @@ static const struct file_operations vfio_device_fops = { · 1326 unmodified lines
13591360 */
13601361 static char *vfio_devnode(struct device *dev, umode_t *mode)
13611362 {
1363+ if (MINOR(dev->devt) == 0)
1364+ *mode = S_IRUGO | S_IWUGO;
1365+
13621366 return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev));
13631367 }
13641368

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t