Skip to content

Commit aed7093

Browse files
mhklinuxliuw
authored andcommitted
drm/hyperv: Fix address space leak when Hyper-V DRM device is removed
When a Hyper-V DRM device is probed, the driver allocates MMIO space for the vram, and maps it cacheable. If the device removed, or in the error path for device probing, the MMIO space is released but no unmap is done. Consequently the kernel address space for the mapping is leaked. Fix this by adding iounmap() calls in the device removal path, and in the error path during device probing. Fixes: f1f63cb ("drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()") Fixes: a0ab5ab ("drm/hyperv : Removing the restruction of VRAM allocation with PCI bar size") Signed-off-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Saurabh Sengar <ssengar@linux.microsoft.com> Tested-by: Saurabh Sengar <ssengar@linux.microsoft.com> Link: https://lore.kernel.org/r/20250210193441.2414-1-mhklinux@outlook.com Signed-off-by: Wei Liu <wei.liu@kernel.org> Message-ID: <20250210193441.2414-1-mhklinux@outlook.com>
1 parent 7241c88 commit aed7093

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpu/drm/hyperv/hyperv_drm_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
154154
return 0;
155155

156156
err_free_mmio:
157+
iounmap(hv->vram);
157158
vmbus_free_mmio(hv->mem->start, hv->fb_size);
158159
err_vmbus_close:
159160
vmbus_close(hdev->channel);
@@ -172,6 +173,7 @@ static void hyperv_vmbus_remove(struct hv_device *hdev)
172173
vmbus_close(hdev->channel);
173174
hv_set_drvdata(hdev, NULL);
174175

176+
iounmap(hv->vram);
175177
vmbus_free_mmio(hv->mem->start, hv->fb_size);
176178
}
177179

0 commit comments

Comments
 (0)