]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mshv: Fix create memory region overlap check
authorNuno Das Neves <nunodasneves@linux.microsoft.com>
Thu, 6 Nov 2025 22:13:30 +0000 (14:13 -0800)
committerWei Liu <wei.liu@kernel.org>
Sat, 15 Nov 2025 06:18:17 +0000 (06:18 +0000)
commitba9eb9b86d232854e983203dc2fb1ba18e316681
tree307576787cf8f419d79f2e1a5238d71d68dcb1bd
parent8ec6070fc8aca0fce6327d8b2cb8bd77adb155c9
mshv: Fix create memory region overlap check

The current check is incorrect; it only checks if the beginning or end
of a region is within an existing region. This doesn't account for
userspace specifying a region that begins before and ends after an
existing region.

Change the logic to a range intersection check against gfns and uaddrs
for each region.

Remove mshv_partition_region_by_uaddr() as it is no longer used.

Fixes: 621191d709b1 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
Reported-by: Michael Kelley <mhklinux@outlook.com>
Closes: https://lore.kernel.org/linux-hyperv/SN6PR02MB41575BE0406D3AB22E1D7DB5D4C2A@SN6PR02MB4157.namprd02.prod.outlook.com/
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/mshv_root_main.c