CVE-2022-50738

Source
https://nvd.nist.gov/vuln/detail/CVE-2022-50738
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50738.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2022-50738
Downstream
Published
2025-12-24T13:05:36.801Z
Modified
2025-12-24T20:19:03.568938Z
Summary
vhost-vdpa: fix an iotlb memory leak
Details

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

vhost-vdpa: fix an iotlb memory leak

Before commit 3d5698793897 ("vhost-vdpa: introduce asid based IOTLB") we called vhostvdpaiotlbunmap(v, iotlb, 0ULL, 0ULL - 1) during release to free all the resources allocated when processing user IOTLB messages through vhostvdpaprocessiotlb_update(). That commit changed the handling of IOTLB a bit, and we accidentally removed some code called during the release.

We partially fixed this with commit 037d4305569a ("vhost-vdpa: call vhostvdpacleanup during the release") but a potential memory leak is still there as showed by kmemleak if the application does not send VHOSTIOTLBINVALIDATE or crashes:

unreferenced object 0xffff888007fbaa30 (size 16): comm "blkio-bench", pid 914, jiffies 4294993521 (age 885.500s) hex dump (first 16 bytes): 40 73 41 07 80 88 ff ff 00 00 00 00 00 00 00 00 @sA............. backtrace: [<0000000087736d2a>] kmemcachealloctrace+0x142/0x1c0 [<0000000060740f50>] vhostvdpaprocessiotlbmsg+0x68c/0x901 [vhostvdpa] [<0000000083e8e205>] vhostchrwriteiter+0xc0/0x4a0 [vhost] [<000000008f2f414a>] vhostvdpachrwriteiter+0x18/0x20 [vhostvdpa] [<00000000de1cd4a0>] vfswrite+0x216/0x4b0 [<00000000a2850200>] ksyswrite+0x71/0xf0 [<00000000de8e720b>] _x64syswrite+0x19/0x20 [<0000000018b12cbb>] dosyscall64+0x3f/0x90 [<00000000986ec465>] entrySYSCALL64after_hwframe+0x63/0xcd

Let's fix this calling vhostvdpaiotlbunmap() on the whole range in vhostvdparemoveas(). We move that call before vhostdevcleanup() since we need a valid v->vdev.mm in vhostvdpapaunmap(). vhostiotlbreset() call can be removed, since vhostvdpaiotlbunmap() on the whole range removes all the entries.

The kmemleak log reported was observed with a vDPA device that has use_va set to true (e.g. VDUSE). This patch has been tested with both types of devices.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50738.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
3d5698793897a2b9c0060d899881d1a0591630d5
Fixed
4e92cb33bfb51eee5f28bb10846c46f266a4bb67
Fixed
a2907867e2c86067accd2f011d6f23ee5533aa6c
Fixed
c070c1912a83432530cbb4271d5b9b11fa36b67a

Affected versions

v5.*

v5.19
v5.19-rc1
v5.19-rc2
v5.19-rc3
v5.19-rc4
v5.19-rc5
v5.19-rc6
v5.19-rc7
v5.19-rc8

v6.*

v6.0
v6.0-rc1
v6.0-rc2
v6.0-rc3
v6.0-rc4
v6.0-rc5
v6.0-rc6
v6.0-rc7
v6.0.1
v6.0.10
v6.0.11
v6.0.12
v6.0.13
v6.0.14
v6.0.15
v6.0.16
v6.0.17
v6.0.18
v6.0.2
v6.0.3
v6.0.4
v6.0.5
v6.0.6
v6.0.7
v6.0.8
v6.0.9
v6.1
v6.1-rc1
v6.1-rc2
v6.1-rc3
v6.1-rc4
v6.1-rc5
v6.1-rc6
v6.1-rc7
v6.1-rc8
v6.1.1
v6.1.2
v6.1.3
v6.1.4
v6.2-rc1

Database specific

source

"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50738.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.19.0
Fixed
6.0.19
Type
ECOSYSTEM
Events
Introduced
6.1.0
Fixed
6.1.5

Database specific

source

"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50738.json"