Skip to contentSkip to conversation

CVE-2026-72138: xen/gntdev: fix error handling in ioctl

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Aug 15

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

xen/gntdev: fix error handling in ioctl

When gntdev_ioctl_map_grant_ref() fails to copy the operation result back to userspace after successfully adding the mapping to the list, the error path returns -EFAULT without releasing the reference acquired by gntdev_alloc_map(). The mapping remains in priv->maps with a refcount of 1, causing a memory leak and a dangling list entry.

Additionally, gntdev_add_map() may modify map->index to avoid overlap with existing mappings. Therefore, the index returned to userspace must be obtained after gntdev_add_map() completes.

Fix this by holding the mutex across gntdev_add_map(), retrieving the correct index, and copy_to_user(). If copy_to_user() fails, remove the mapping from the list and release the reference while still holding the lock.

Fix these issues by properly handling all error cases.

The Linux kernel CVE team has assigned CVE-2026-72138 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 5.10.261 with commit 52dc40ef0cfee6ae89b7524967e73f0ba37906d7
	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 5.15.212 with commit 1dd9cb98fe228e017fff9efb33862ff38c741b65
	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 6.1.178 with commit 6df926130aee6cab9b5d2e5b7862e49ccac348dc
	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 6.6.145 with commit 311011f8cc206c5af2877b03e3f627ee1b8fe024
	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 6.12.97 with commit 18a693733f7ad004e1ab0466693121ca70cd95dd
	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 6.18.40 with commit 16d3ccdabb8dee9be2cdcd6d3f9a125572ec0454
	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 7.1.5 with commit 6883269a323609f68f6faa903f8f8ff3d191cec8
	Issue introduced in 2.6.39 with commit 68b025c813c2eb41ff25628e3d4952d5185eb1a4 and fixed in 7.2-rc2 with commit 45ca1afe2fd14c04e37227e79d3f8455831d8408

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-72138

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/xen/gntdev.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/52dc40ef0cfee6ae89b7524967e73f0ba37906d7
	https://git.kernel.org/stable/c/1dd9cb98fe228e017fff9efb33862ff38c741b65
	https://git.kernel.org/stable/c/6df926130aee6cab9b5d2e5b7862e49ccac348dc
	https://git.kernel.org/stable/c/311011f8cc206c5af2877b03e3f627ee1b8fe024
	https://git.kernel.org/stable/c/18a693733f7ad004e1ab0466693121ca70cd95dd
	https://git.kernel.org/stable/c/16d3ccdabb8dee9be2cdcd6d3f9a125572ec0454
	https://git.kernel.org/stable/c/6883269a323609f68f6faa903f8f8ff3d191cec8
	https://git.kernel.org/stable/c/45ca1afe2fd14c04e37227e79d3f8455831d8408