diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-03-24 17:39:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-03-24 17:39:36 -0400 |
commit | d07c6f46c441c32c55076a45479530707170c55c (patch) | |
tree | 2635d640df112a3039556ee602760ebb2454694b | |
parent | 04e904aa79ccdeede66d58e72e4c5402e4b9bd70 (diff) | |
parent | 65b1adebfe43c642dfe3b109edb5d992db5fbe72 (diff) |
Merge tag 'vfio-v4.11-rc4' of git://github.com/awilliam/linux-vfio
Pull VFIO fix from Alex Williamson:
"Rework sanity check for mdev driver group notifier de-registration
(Alex Williamson)"
* tag 'vfio-v4.11-rc4' of git://github.com/awilliam/linux-vfio:
vfio: Rework group release notifier warning
-rw-r--r-- | drivers/vfio/vfio.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 609f4f982c74..561084ab387f 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c | |||
@@ -403,6 +403,7 @@ static void vfio_group_release(struct kref *kref) | |||
403 | struct iommu_group *iommu_group = group->iommu_group; | 403 | struct iommu_group *iommu_group = group->iommu_group; |
404 | 404 | ||
405 | WARN_ON(!list_empty(&group->device_list)); | 405 | WARN_ON(!list_empty(&group->device_list)); |
406 | WARN_ON(group->notifier.head); | ||
406 | 407 | ||
407 | list_for_each_entry_safe(unbound, tmp, | 408 | list_for_each_entry_safe(unbound, tmp, |
408 | &group->unbound_list, unbound_next) { | 409 | &group->unbound_list, unbound_next) { |
@@ -1573,6 +1574,10 @@ static int vfio_group_fops_open(struct inode *inode, struct file *filep) | |||
1573 | return -EBUSY; | 1574 | return -EBUSY; |
1574 | } | 1575 | } |
1575 | 1576 | ||
1577 | /* Warn if previous user didn't cleanup and re-init to drop them */ | ||
1578 | if (WARN_ON(group->notifier.head)) | ||
1579 | BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier); | ||
1580 | |||
1576 | filep->private_data = group; | 1581 | filep->private_data = group; |
1577 | 1582 | ||
1578 | return 0; | 1583 | return 0; |
@@ -1584,9 +1589,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep) | |||
1584 | 1589 | ||
1585 | filep->private_data = NULL; | 1590 | filep->private_data = NULL; |
1586 | 1591 | ||
1587 | /* Any user didn't unregister? */ | ||
1588 | WARN_ON(group->notifier.head); | ||
1589 | |||
1590 | vfio_group_try_dissolve_container(group); | 1592 | vfio_group_try_dissolve_container(group); |
1591 | 1593 | ||
1592 | atomic_dec(&group->opened); | 1594 | atomic_dec(&group->opened); |