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 427C23446C7 for ; Wed, 24 Dec 2025 13:09:32 +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=1766581772; cv=none; b=i2D6plnqqL+g37c0DfQX+gWdnfrrMjTnZnRcz/kw8GWRd5N81PT/58vodDVNkxrb41+mRki8b3CK1yjYPXuFdkUgQznK2xSifRHgUdn1wpagTG9xdEyiViNMltUOyuq3ehBfI7q1i4v9xA1z3+Gy15BkI94bwE8iVwuHyr7Khxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766581772; c=relaxed/simple; bh=zh23t2qqOeOI8pUDDmrzFLy4vLxzjti5jZ7+6eLNKoI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MjLgHzM6aI6OIIQk8vfPnxenCStdoegCeJP9o6y4WQIE0TxExeP10Mjpkt5Flb1FXQpFEYjx4JEOWpj/YNWSfZqLTnNQKHiw4AJpsHfSezPimsl7LzcGKni4fE7bMiRghpxquJdf4QFuaVbugMLCcvrh5dSoJ9fGUXNOKQpzVcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=k+23Y7jY; 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="k+23Y7jY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF721C4CEFB; Wed, 24 Dec 2025 13:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1766581772; bh=zh23t2qqOeOI8pUDDmrzFLy4vLxzjti5jZ7+6eLNKoI=; h=From:To:Cc:Subject:Date:Reply-To:From; b=k+23Y7jYc8EOB6X8xofab55a1+2/34Fyf4pI1z5d7ONJnhYVJUywto6DMKrye6f38 eGUQqIwY7xkntCTSMiawhXJSQEBjqKzMv7l5mAXBvRbVm0pBYpUiHdZ9p+FaROSDc9 pqekW0Ixtwy6RXFdWBwmq/nhHvh91wqFipS803ms= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50774: crypto: qat - fix DMA transfer direction Date: Wed, 24 Dec 2025 14:06:25 +0100 Message-ID: <2025122459-CVE-2022-50774-73eb@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=4749; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=W/zoGGP5vAM4iEuE4hjnvyGBD14zc+GZlLy/LicncJU=; b=owGbwMvMwCRo6H6F97bub03G02pJDJneT82fOLK1Vyl3e9V+/6iVeeZrcsEF/iqvhV8YtkZdq XS1UlvREcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABNhn8gwP2m5QszGB+lLNz/Z e0fyNrPhjEffWBkWzN8V4Mu46dz+kL5+S75/t9e///AzCQA= 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: crypto: qat - fix DMA transfer direction When CONFIG_DMA_API_DEBUG is selected, while running the crypto self test on the QAT crypto algorithms, the function add_dma_entry() reports a warning similar to the one below, saying that overlapping mappings are not supported. This occurs in tests where the input and the output scatter list point to the same buffers (i.e. two different scatter lists which point to the same chunks of memory). The logic that implements the mapping uses the flag DMA_BIDIRECTIONAL for both the input and the output scatter lists which leads to overlapped write mappings. These are not supported by the DMA layer. Fix by specifying the correct DMA transfer directions when mapping buffers. For in-place operations where the input scatter list matches the output scatter list, buffers are mapped once with DMA_BIDIRECTIONAL, otherwise input buffers are mapped using the flag DMA_TO_DEVICE and output buffers are mapped with DMA_FROM_DEVICE. Overlapping a read mapping with a write mapping is a valid case in dma-coherent devices like QAT. The function that frees and unmaps the buffers, qat_alg_free_bufl() has been changed accordingly to the changes to the mapping function. DMA-API: 4xxx 0000:06:00.0: cacheline tracking EEXIST, overlapping mappings aren't supported WARNING: CPU: 53 PID: 4362 at kernel/dma/debug.c:570 add_dma_entry+0x1e9/0x270 ... Call Trace: dma_map_page_attrs+0x82/0x2d0 ? preempt_count_add+0x6a/0xa0 qat_alg_sgl_to_bufl+0x45b/0x990 [intel_qat] qat_alg_aead_dec+0x71/0x250 [intel_qat] crypto_aead_decrypt+0x3d/0x70 test_aead_vec_cfg+0x649/0x810 ? number+0x310/0x3a0 ? vsnprintf+0x2a3/0x550 ? scnprintf+0x42/0x70 ? valid_sg_divisions.constprop.0+0x86/0xa0 ? test_aead_vec+0xdf/0x120 test_aead_vec+0xdf/0x120 alg_test_aead+0x185/0x400 alg_test+0x3d8/0x500 ? crypto_acomp_scomp_free_ctx+0x30/0x30 ? __schedule+0x32a/0x12a0 ? ttwu_queue_wakelist+0xbf/0x110 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? try_to_wake_up+0x83/0x570 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? __set_cpus_allowed_ptr_locked+0xea/0x1b0 ? crypto_acomp_scomp_free_ctx+0x30/0x30 cryptomgr_test+0x27/0x50 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 The Linux kernel CVE team has assigned CVE-2022-50774 to this issue. Affected and fixed versions =========================== Issue introduced in 3.17 with commit d370cec3219490656d72f5ae6e5df32c113c5a44 and fixed in 5.10.150 with commit 426d5bc089e7731e36b514d1beca19e777a2d653 Issue introduced in 3.17 with commit d370cec3219490656d72f5ae6e5df32c113c5a44 and fixed in 5.15.75 with commit 1f1ab76e251521bd2fa5244473efcf663792745d Issue introduced in 3.17 with commit d370cec3219490656d72f5ae6e5df32c113c5a44 and fixed in 5.19.17 with commit 429348d4f675e9eb418d0829064c4d7d06bd66a3 Issue introduced in 3.17 with commit d370cec3219490656d72f5ae6e5df32c113c5a44 and fixed in 6.0.3 with commit c4c9d9edf4848aed89516b23b88950b194beff6a Issue introduced in 3.17 with commit d370cec3219490656d72f5ae6e5df32c113c5a44 and fixed in 6.1 with commit cf5bb835b7c8a5fee7f26455099cca7feb57f5e9 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-50774 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/crypto/qat/qat_common/qat_algs.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/426d5bc089e7731e36b514d1beca19e777a2d653 https://git.kernel.org/stable/c/1f1ab76e251521bd2fa5244473efcf663792745d https://git.kernel.org/stable/c/429348d4f675e9eb418d0829064c4d7d06bd66a3 https://git.kernel.org/stable/c/c4c9d9edf4848aed89516b23b88950b194beff6a https://git.kernel.org/stable/c/cf5bb835b7c8a5fee7f26455099cca7feb57f5e9