VFIO fixes for v4.11-rc4

- Rework sanity check for mdev driver group notifier de-registration
    (Alex Williamson)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJY1UFMAAoJECObm247sIsiKiwQAIiB+7sobUsKHaBtlqlybyGR
 xQuU/vv0YfaSmRQJGpSSCP8jctUszpVc1fzce/mP8G/HTOBnbMGk3c2VP3gAZQb7
 bkGXfvslmFstj301Kf7xOYazGUXHkDXTQMzYf9v8JsAt4WfoYORhTuUR1//rj0gf
 qocEwfrxVOotwN6C2EeuEGa4WBZ7n9HC2fB8cSAo9FOH7HhT/Y/vztZ9NwYoJSZo
 sgufl42hRusQaiS4JD9sakny2KhBujrCWxT/qPwPHaGHxNvM/8z+96IrMhhL4CMi
 85VMIEoPZIZ9vQY26PQRR/b1hXgTF1vwn7bwL/HCCKnIxe+0e0VaFZ4xxWTfuHKz
 g86VpGVpxfYfZl4KSMatNS+M4eJwrANGHnT6c2tJWxIG8ApVgWE1Ae9ae9L9fkYV
 mYUNuQuugQh6WQaNyhlY7Watc7/6FM5XuCtxo8BfdqoKWtZGUU2TO8c/jjOdzfBU
 4UJjyzbROAGGNRnCp7qekakBGpKUjlaMenKyf9ZbAJzi5RGjJF41HXCq2P5nA8+x
 xsSUVXUW33+M06MTmfQ4THdelRTPZkMLDxGvvIfHc3KKztDKZdt8R2CoHKWxgOLi
 mlNYnSmMaVTBbZxO2jaEf3CKJu/Rcs4kkDqXPYcd/KPFtQRETEwNHC8sgx6VMDhJ
 4nG+YnX6Shz0mRheOiuZ
 =nnnX
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2017-03-24 14:39:36 -07:00
commit d07c6f46c4

View File

@ -403,6 +403,7 @@ static void vfio_group_release(struct kref *kref)
struct iommu_group *iommu_group = group->iommu_group;
WARN_ON(!list_empty(&group->device_list));
WARN_ON(group->notifier.head);
list_for_each_entry_safe(unbound, tmp,
&group->unbound_list, unbound_next) {
@ -1573,6 +1574,10 @@ static int vfio_group_fops_open(struct inode *inode, struct file *filep)
return -EBUSY;
}
/* Warn if previous user didn't cleanup and re-init to drop them */
if (WARN_ON(group->notifier.head))
BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
filep->private_data = group;
return 0;
@ -1584,9 +1589,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep)
filep->private_data = NULL;
/* Any user didn't unregister? */
WARN_ON(group->notifier.head);
vfio_group_try_dissolve_container(group);
atomic_dec(&group->opened);