summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kelley <mhklinux@outlook.com>2025-02-10 11:34:41 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-22 12:56:41 -0700
commit158242b56bf465a73e1edeac0fe828a8acad4499 (patch)
treec7694dba1296420ff29a1cdf82bd7d7ff3e98c80
parent1ba960112e1cce0aafebdf99d3a7b66c94743a0c (diff)
downloadlinux-158242b56bf465a73e1edeac0fe828a8acad4499.tar.gz
linux-158242b56bf465a73e1edeac0fe828a8acad4499.tar.bz2
linux-158242b56bf465a73e1edeac0fe828a8acad4499.zip
drm/hyperv: Fix address space leak when Hyper-V DRM device is removed
[ Upstream commit aed709355fd05ef747e1af24a1d5d78cd7feb81e ] 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: f1f63cbb705d ("drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()") Fixes: a0ab5abced55 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/gpu/drm/hyperv/hyperv_drm_drv.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index e0953777a206..b491827941f1 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -156,6 +156,7 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
return 0;
err_free_mmio:
+ iounmap(hv->vram);
vmbus_free_mmio(hv->mem->start, hv->fb_size);
err_vmbus_close:
vmbus_close(hdev->channel);
@@ -174,6 +175,7 @@ static void hyperv_vmbus_remove(struct hv_device *hdev)
vmbus_close(hdev->channel);
hv_set_drvdata(hdev, NULL);
+ iounmap(hv->vram);
vmbus_free_mmio(hv->mem->start, hv->fb_size);
}