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 2D085220F2D for ; Wed, 24 Dec 2025 13:06:34 +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=1766581595; cv=none; b=n/X4apC4zO6JXewHgAi/7Axvu0kL5qjyIC0iBZ4GghBVnmsdxBObrx6Vg9dHfW3TcZryjnxIZVb1YvIq3hlZXowbTyWoxV/OcSVjQyCMhgtG3/dOJVjfZPpA98qYxL4jaa8qBguoBsxnzNY40/roi5t6N8KuAMpnDO+x6cdrZZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766581595; c=relaxed/simple; bh=cAKumID1bYzyxyAW6ssKk1An+W6CI5+mnsovqtIsi2o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rXiuRCkO0wLFNvQmG4oEvIhmRsbZTC9eEhTieC+YqHD6GtikkBTuSTe+3G09Kj6qJ3R9EngR7wts2Tv79NnKkYZ06g9GN0n8O2dpUzJr6+QIvrb0H6DJWjS3wZfW49TCi+R+XNL0v9xT92S4oWMINpPgw/hM+T7syBFUfVBJanA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0xyEAcw/; 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="0xyEAcw/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A73EC4CEFB; Wed, 24 Dec 2025 13:06:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1766581594; bh=cAKumID1bYzyxyAW6ssKk1An+W6CI5+mnsovqtIsi2o=; h=From:To:Cc:Subject:Date:Reply-To:From; b=0xyEAcw//nfFzYuqGQ5M+tOqDi3C7ukbY3Ke4DS0GZWE4elxVO6WbAo6uXdS0EW0y WGXqTe6jaalsdwiCKMT0qujNKs5sA3wBcrOCl9EQzEM2Ik82rCxo4BVj9kXA2EACEC Y5urIexgPW8Q3SaYmPEzg/FNhifVioUv3eqxhuiQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50738: vhost-vdpa: fix an iotlb memory leak Date: Wed, 24 Dec 2025 14:05:49 +0100 Message-ID: <2025122447-CVE-2022-50738-d561@gregkh> X-Mailer: git-send-email 2.52.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3881; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=SzZ2hIih+KCmVHotWn/WQ231fU1IomDQfRKBdVUMU2U=; b=owGbwMvMwCRo6H6F97bub03G02pJDJneT3XWH5shd1fyYWbV9Mbu70+2/dBfuPdVXfXTB+6qX ZPvPOec2xHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQATkdjKME/1rtyxkx/0937L vSnb6rzerazi+TKGBa2TFMoZM3Rcjp4zs1N9NGX149TzzgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== 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 vhost_vdpa_iotlb_unmap(v, iotlb, 0ULL, 0ULL - 1) during release to free all the resources allocated when processing user IOTLB messages through vhost_vdpa_process_iotlb_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 vhost_vdpa_cleanup during the release") but a potential memory leak is still there as showed by kmemleak if the application does not send VHOST_IOTLB_INVALIDATE 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>] kmem_cache_alloc_trace+0x142/0x1c0 [<0000000060740f50>] vhost_vdpa_process_iotlb_msg+0x68c/0x901 [vhost_vdpa] [<0000000083e8e205>] vhost_chr_write_iter+0xc0/0x4a0 [vhost] [<000000008f2f414a>] vhost_vdpa_chr_write_iter+0x18/0x20 [vhost_vdpa] [<00000000de1cd4a0>] vfs_write+0x216/0x4b0 [<00000000a2850200>] ksys_write+0x71/0xf0 [<00000000de8e720b>] __x64_sys_write+0x19/0x20 [<0000000018b12cbb>] do_syscall_64+0x3f/0x90 [<00000000986ec465>] entry_SYSCALL_64_after_hwframe+0x63/0xcd Let's fix this calling vhost_vdpa_iotlb_unmap() on the whole range in vhost_vdpa_remove_as(). We move that call before vhost_dev_cleanup() since we need a valid v->vdev.mm in vhost_vdpa_pa_unmap(). vhost_iotlb_reset() call can be removed, since vhost_vdpa_iotlb_unmap() 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. The Linux kernel CVE team has assigned CVE-2022-50738 to this issue. Affected and fixed versions =========================== Issue introduced in 5.19 with commit 3d5698793897a2b9c0060d899881d1a0591630d5 and fixed in 6.0.19 with commit 4e92cb33bfb51eee5f28bb10846c46f266a4bb67 Issue introduced in 5.19 with commit 3d5698793897a2b9c0060d899881d1a0591630d5 and fixed in 6.1.5 with commit a2907867e2c86067accd2f011d6f23ee5533aa6c Issue introduced in 5.19 with commit 3d5698793897a2b9c0060d899881d1a0591630d5 and fixed in 6.2 with commit c070c1912a83432530cbb4271d5b9b11fa36b67a 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-2022-50738 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/vhost/vdpa.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/4e92cb33bfb51eee5f28bb10846c46f266a4bb67 https://git.kernel.org/stable/c/a2907867e2c86067accd2f011d6f23ee5533aa6c https://git.kernel.org/stable/c/c070c1912a83432530cbb4271d5b9b11fa36b67a