drm/hyperv: Fix device removal on Gen1 VMs
authorMohammed Gamal <mgamal@redhat.com>
Fri, 19 Nov 2021 11:29:00 +0000 (12:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Dec 2021 08:04:51 +0000 (09:04 +0100)
commit85851d9ff790509a42aa12a770ead6e84e427eeb
tree1cbb6022c131423f1c12dd6ad5b7238613c9b0e3
parent63a68f37718294ab0c1d07699845b4c88f6d5f00
drm/hyperv: Fix device removal on Gen1 VMs

[ Upstream commit e048834c209a02e3776bcc47d43c6d863e3a67ca ]

The Hyper-V DRM driver tries to free MMIO region on removing
the device regardless of VM type, while Gen1 VMs don't use MMIO
and hence causing the kernel to crash on a NULL pointer dereference.

Fix this by making deallocating MMIO only on Gen2 machines and implement
removal for Gen1

Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
Reviewed-by: Deepak Rawat <drawat.floss@gmail.com>
Signed-off-by: Deepak Rawat <drawat.floss@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211119112900.300537-1-mgamal@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/hyperv/hyperv_drm_drv.c