From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E8C71C9B6C; Wed, 19 Mar 2025 14:34:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742394871; cv=none; b=PUCMoxLZLG1sU4oaJAW+UJFeFiJl7adaXhMgYyG7mjxbumoPU3pRCzvMmqSKCykgASd3daiPaHmFyuQwVL1wL75E0j7brzKSoyecbbYWDG6SPhxSvGk45RDMr3yCEobclNA70J9Fjr+dcqWLMg25DjtrDloy8FaNW4IldzJ7I3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742394871; c=relaxed/simple; bh=yQiDEIKV2t1mp2RGAnpziuIPNVq13SGP9wzs5i6qRWM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CJruqfloYyYYhQokVHEkINTPN3/hug7YT7iPGaUKSmg3YNnj+QXUzCtm2ZIUx6imERjCuSwIlY2oQkUnKJ4my7TO9ihQPUchZu6nkVwkup/NU7tqIqC1WqEoVUFr9XJiq6dpg4EkzC+Xnyq6bd8yZQA8k7sBPVmEjx31yEJzpoE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ybapy3tL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ybapy3tL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36A93C4CEE8; Wed, 19 Mar 2025 14:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742394871; bh=yQiDEIKV2t1mp2RGAnpziuIPNVq13SGP9wzs5i6qRWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ybapy3tLgL9eDUAzAsJ7+kEu8blN9BFHliYCiH0E07YbGnx1DRQo8H/8JkDa3p5YS OvT42SWBiWftejdSXFrN+q6gtd5Dpp5Mx369gxPgTSfTA8EXw2BNd1yibhIc4wSN0N O74fJZsFt0Y1lP3pCjWKK+TvDHDSJsOAUf3koXd8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Kelley , Saurabh Sengar , Wei Liu , Sasha Levin Subject: [PATCH 6.13 026/241] drm/hyperv: Fix address space leak when Hyper-V DRM device is removed Date: Wed, 19 Mar 2025 07:28:16 -0700 Message-ID: <20250319143028.357315986@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250319143027.685727358@linuxfoundation.org> References: <20250319143027.685727358@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Kelley [ 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 Reviewed-by: Saurabh Sengar Tested-by: Saurabh Sengar Link: https://lore.kernel.org/r/20250210193441.2414-1-mhklinux@outlook.com Signed-off-by: Wei Liu Message-ID: <20250210193441.2414-1-mhklinux@outlook.com> Signed-off-by: Sasha Levin --- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c index e0953777a2066..b491827941f19 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); } -- 2.39.5