Skip to content

Commit

Permalink
vfio: fix crash on rmmod
Browse files Browse the repository at this point in the history
devtmpfs_delete_node() calls devnode() callback with mode==NULL but
vfio still tries to write there.

The patch fixes this.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
Alexey Kardashevskiy authored and Alex Williamson committed Jun 5, 2013
1 parent d683b96 commit 9a6aa27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/vfio/vfio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ static const struct file_operations vfio_device_fops = {
*/
static char *vfio_devnode(struct device *dev, umode_t *mode)
{
if (MINOR(dev->devt) == 0)
if (mode && (MINOR(dev->devt) == 0))
*mode = S_IRUGO | S_IWUGO;

return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev));
Expand Down

0 comments on commit 9a6aa27

Please sign in to comment.