Skip to content

Commit f88cd3f

Browse files
committed
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()
2 parents 143d28d + dc51ff9 commit f88cd3f

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

drivers/vfio/pci/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
config VFIO_PCI
33
tristate "VFIO support for PCI devices"
44
depends on VFIO && PCI && EVENTFD
5+
depends on MMU
56
select VFIO_VIRQFD
67
select IRQ_BYPASS_MANAGER
78
help

drivers/vfio/pci/vfio_pci_config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev)
15811581
if (len == 0xFF) {
15821582
len = vfio_ext_cap_len(vdev, ecap, epos);
15831583
if (len < 0)
1584-
return ret;
1584+
return len;
15851585
}
15861586
}
15871587

drivers/vfio/platform/vfio_platform_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static int vfio_platform_open(struct vfio_device *core_vdev)
291291
vfio_platform_regions_cleanup(vdev);
292292
err_reg:
293293
mutex_unlock(&driver_lock);
294-
module_put(THIS_MODULE);
294+
module_put(vdev->parent_module);
295295
return ret;
296296
}
297297

drivers/vfio/vfio_iommu_type1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,7 @@ static int vfio_iommu_iova_build_caps(struct vfio_iommu *iommu,
27952795
return 0;
27962796
}
27972797

2798-
size = sizeof(*cap_iovas) + (iovas * sizeof(*cap_iovas->iova_ranges));
2798+
size = struct_size(cap_iovas, iova_ranges, iovas);
27992799

28002800
cap_iovas = kzalloc(size, GFP_KERNEL);
28012801
if (!cap_iovas)

samples/vfio-mdev/mdpy-fb.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,27 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
117117
if (format != DRM_FORMAT_XRGB8888) {
118118
pci_err(pdev, "format mismatch (0x%x != 0x%x)\n",
119119
format, DRM_FORMAT_XRGB8888);
120-
return -EINVAL;
120+
ret = -EINVAL;
121+
goto err_release_regions;
121122
}
122123
if (width < 100 || width > 10000) {
123124
pci_err(pdev, "width (%d) out of range\n", width);
124-
return -EINVAL;
125+
ret = -EINVAL;
126+
goto err_release_regions;
125127
}
126128
if (height < 100 || height > 10000) {
127129
pci_err(pdev, "height (%d) out of range\n", height);
128-
return -EINVAL;
130+
ret = -EINVAL;
131+
goto err_release_regions;
129132
}
130133
pci_info(pdev, "mdpy found: %dx%d framebuffer\n",
131134
width, height);
132135

133136
info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
134-
if (!info)
137+
if (!info) {
138+
ret = -ENOMEM;
135139
goto err_release_regions;
140+
}
136141
pci_set_drvdata(pdev, info);
137142
par = info->par;
138143

0 commit comments

Comments
 (0)