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 AAD741D7E41 for ; Tue, 9 Dec 2025 00:03:02 +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=1765238582; cv=none; b=nec2FyfpsNUsOdut5HdCj1QEbkBMby+xpEgmvkl5ddG7E97y1y3wk4P0M3oi42YXI4KEkAOnXWx/YkE+ZqR5atKaMX9hPNWPv8Ka9hZni9w2KtbY5GC8A5RiboaCl7Fq0g/zRh5BOk8KTW3Qz222Jrwd3sdKrpA0+LWOdRqlgRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765238582; c=relaxed/simple; bh=Iuy3KgZaOXW3Q2JN8jU3KUg0ISiECjVzDePbNG/uJv0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kjR1vAiU9951SpBjmxwUzKFe64e9xD/gcOeGBV7+jxjLurJI4VqNwsdNcZMYQ8mbgOI4lGXqjE51l/f45RSkKDwBdjlPEwc22x7NoOJhCgq81uR0vPJwg0ETHvVxzfI9aLTENUSJM9yJL7f7ogJ50l+eLOmtBPX9uFmFqLw8gYI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EnVxYMpo; 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="EnVxYMpo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1136BC4CEF1; Tue, 9 Dec 2025 00:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765238582; bh=Iuy3KgZaOXW3Q2JN8jU3KUg0ISiECjVzDePbNG/uJv0=; h=From:To:Cc:Subject:Date:Reply-To:From; b=EnVxYMpo5lg6myZNwcRcPRboxZfci5b/vGAEp/9w9fFk4pygX1ZdBmctLZ89wrfAA +EJAGNdKWrJuhgQESL+DUthFJbu+SNA+BJSWiUn7jP/Mcl+TwchJ6t5dtXPuukWRA8 tIDeYs4KsAG/vbvwKNm6kUtkgDdbWz1OIoy50kac= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53778: accel/qaic: Clean up integer overflow checking in map_user_pages() Date: Tue, 9 Dec 2025 09:01:59 +0900 Message-ID: <2025120938-CVE-2023-53778-ee4d@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=3435; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=YnSqQOA6ZWVGMbUmJVEmmq5M/ZNsGgAcoGOkvwcihoo=; b=owGbwMvMwCRo6H6F97bub03G02pJDJnmaY+1Dk9Nz3jkkLh+wZT3B8qTQv8ulnjPU52tb7Dud 1mBQ+LsjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiI4TaG+Q5mtU+PP6ypZK76 fT6nbf+/wOhCRYb5hb6TDt/h5OK5Ixtmf9hNunXHt64NAA== 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: accel/qaic: Clean up integer overflow checking in map_user_pages() The encode_dma() function has some validation on in_trans->size but it would be more clear to move those checks to find_and_map_user_pages(). The encode_dma() had two checks: if (in_trans->addr + in_trans->size < in_trans->addr || !in_trans->size) return -EINVAL; The in_trans->addr variable is the starting address. The in_trans->size variable is the total size of the transfer. The transfer can occur in parts and the resources->xferred_dma_size tracks how many bytes we have already transferred. This patch introduces a new variable "remaining" which represents the amount we want to transfer (in_trans->size) minus the amount we have already transferred (resources->xferred_dma_size). I have modified the check for if in_trans->size is zero to instead check if in_trans->size is less than resources->xferred_dma_size. If we have already transferred more bytes than in_trans->size then there are negative bytes remaining which doesn't make sense. If there are zero bytes remaining to be copied, just return success. The check in encode_dma() checked that "addr + size" could not overflow and barring a driver bug that should work, but it's easier to check if we do this in parts. First check that "in_trans->addr + resources->xferred_dma_size" is safe. Then check that "xfer_start_addr + remaining" is safe. My final concern was that we are dealing with u64 values but on 32bit systems the kmalloc() function will truncate the sizes to 32 bits. So I calculated "total = in_trans->size + offset_in_page(xfer_start_addr);" and returned -EINVAL if it were >= SIZE_MAX. This will not affect 64bit systems. The Linux kernel CVE team has assigned CVE-2023-53778 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit 129776ac2e38231fa9c02ce20e116c99de291666 and fixed in 6.4.12 with commit d410a96e5cb8c1ec7049c83f2edcd8bbfaf5d9b3 Issue introduced in 6.4 with commit 129776ac2e38231fa9c02ce20e116c99de291666 and fixed in 6.5 with commit 96d3c1cadedb6ae2e8965e19cd12caa244afbd9c 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-2023-53778 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/accel/qaic/qaic_control.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/d410a96e5cb8c1ec7049c83f2edcd8bbfaf5d9b3 https://git.kernel.org/stable/c/96d3c1cadedb6ae2e8965e19cd12caa244afbd9c