Commit f88cd3fb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'vfio-v5.13-rc5' of git://github.com/awilliam/linux-vfio

Pull VFIO fixes from Alex Williamson:

 - Fix error path return value (Zhen Lei)

 - Add vfio-pci CONFIG_MMU dependency (Randy Dunlap)

 - Replace open coding with struct_size() (Gustavo A. R. Silva)

 - Fix sample driver error path (Wei Yongjun)

 - Fix vfio-platform error path module_put() (Max Gurtovoy)

* tag 'vfio-v5.13-rc5' of git://github.com/awilliam/linux-vfio:
  vfio/platform: fix module_put call in error flow
  samples: vfio-mdev: fix error handing in mdpy_fb_probe()
  vfio/iommu_type1: Use struct_size() for kzalloc()
  vfio/pci: zap_vma_ptes() needs MMU
  vfio/pci: Fix error return code in vfio_ecap_init()
parents 143d28dc dc51ff91
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
config VFIO_PCI config VFIO_PCI
tristate "VFIO support for PCI devices" tristate "VFIO support for PCI devices"
depends on VFIO && PCI && EVENTFD depends on VFIO && PCI && EVENTFD
depends on MMU
select VFIO_VIRQFD select VFIO_VIRQFD
select IRQ_BYPASS_MANAGER select IRQ_BYPASS_MANAGER
help help
......
...@@ -1581,7 +1581,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev) ...@@ -1581,7 +1581,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev)
if (len == 0xFF) { if (len == 0xFF) {
len = vfio_ext_cap_len(vdev, ecap, epos); len = vfio_ext_cap_len(vdev, ecap, epos);
if (len < 0) if (len < 0)
return ret; return len;
} }
} }
......
...@@ -291,7 +291,7 @@ static int vfio_platform_open(struct vfio_device *core_vdev) ...@@ -291,7 +291,7 @@ static int vfio_platform_open(struct vfio_device *core_vdev)
vfio_platform_regions_cleanup(vdev); vfio_platform_regions_cleanup(vdev);
err_reg: err_reg:
mutex_unlock(&driver_lock); mutex_unlock(&driver_lock);
module_put(THIS_MODULE); module_put(vdev->parent_module);
return ret; return ret;
} }
......
...@@ -2795,7 +2795,7 @@ static int vfio_iommu_iova_build_caps(struct vfio_iommu *iommu, ...@@ -2795,7 +2795,7 @@ static int vfio_iommu_iova_build_caps(struct vfio_iommu *iommu,
return 0; return 0;
} }
size = sizeof(*cap_iovas) + (iovas * sizeof(*cap_iovas->iova_ranges)); size = struct_size(cap_iovas, iova_ranges, iovas);
cap_iovas = kzalloc(size, GFP_KERNEL); cap_iovas = kzalloc(size, GFP_KERNEL);
if (!cap_iovas) if (!cap_iovas)
......
...@@ -117,22 +117,27 @@ static int mdpy_fb_probe(struct pci_dev *pdev, ...@@ -117,22 +117,27 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
if (format != DRM_FORMAT_XRGB8888) { if (format != DRM_FORMAT_XRGB8888) {
pci_err(pdev, "format mismatch (0x%x != 0x%x)\n", pci_err(pdev, "format mismatch (0x%x != 0x%x)\n",
format, DRM_FORMAT_XRGB8888); format, DRM_FORMAT_XRGB8888);
return -EINVAL; ret = -EINVAL;
goto err_release_regions;
} }
if (width < 100 || width > 10000) { if (width < 100 || width > 10000) {
pci_err(pdev, "width (%d) out of range\n", width); pci_err(pdev, "width (%d) out of range\n", width);
return -EINVAL; ret = -EINVAL;
goto err_release_regions;
} }
if (height < 100 || height > 10000) { if (height < 100 || height > 10000) {
pci_err(pdev, "height (%d) out of range\n", height); pci_err(pdev, "height (%d) out of range\n", height);
return -EINVAL; ret = -EINVAL;
goto err_release_regions;
} }
pci_info(pdev, "mdpy found: %dx%d framebuffer\n", pci_info(pdev, "mdpy found: %dx%d framebuffer\n",
width, height); width, height);
info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev); info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
if (!info) if (!info) {
ret = -ENOMEM;
goto err_release_regions; goto err_release_regions;
}
pci_set_drvdata(pdev, info); pci_set_drvdata(pdev, info);
par = info->par; par = info->par;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment