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 228A7374C4 for ; Sun, 29 Dec 2024 08:49:11 +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=1735462151; cv=none; b=EMZo3XYI+Kd4EWbsVgzfbaiVbz1qrhJ/1r0cBnFkIYSR9ovar8PJcQ/FK8GKJh1IwGWa5KnoBRI5qyWS5aQjCljhI+ReVyB0DtsACRRNnLzy59Fu7Wu7rseqlqL9Wm3hjEPdNqoMr1d8SPS7edGGcdcrZ2ckmdjSyKOrfNqpM7Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735462151; c=relaxed/simple; bh=RBddQT3rCYQpUudQLEq5qpFDseOHa/T9J4k9wPzGhjQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ai5dJpbySlSrLGkK4FPscWB9Hf6/rKKDPJAeDM60v0panlFTy9PKrAcahWs+0PoJ/LUTp0ITRT7K6sV7mW/iD8BHpMYi/Bug0YskfKcuhC6cAR7eFQwA87PVhRMttnoEXxtUmR4uClT3o6nMtcbbfoDLh+q6a6gEXKBnGItx5pA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WmqtCXRB; 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="WmqtCXRB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7098AC4CED1; Sun, 29 Dec 2024 08:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735462150; bh=RBddQT3rCYQpUudQLEq5qpFDseOHa/T9J4k9wPzGhjQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=WmqtCXRBl4lixf3nVH62FH85ovHRFOlEDL2meitjdAt6Q2nQnfIPdnepdjvSR9f1e fm/BTVpOAaebzTTnqqfbk3D6RyBsXxVU07vc9MnxYETAf/xEvv18ggrwxoqXFqMk0W cPZK89AIs3EUZUsJ+DaybN9tsn6H6+gx3llL9VO4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56712: udmabuf: fix memory leak on last export_udmabuf() error path Date: Sun, 29 Dec 2024 09:48:16 +0100 Message-ID: <2024122914-CVE-2024-56712-d62a@gregkh> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2486; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=RBddQT3rCYQpUudQLEq5qpFDseOHa/T9J4k9wPzGhjQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDOmFPOe2SBn/2bnM12HSUZU90YeEdonrrFp4ru7S/idha Xu53yy374hlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJdJkyLGi5XjFd4054mG7k j/C4/f+XxB3nymWYn8R1RfkK677qJOE1cR5SaUxCp7u9AQ== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: udmabuf: fix memory leak on last export_udmabuf() error path In export_udmabuf(), if dma_buf_fd() fails because the FD table is full, a dma_buf owning the udmabuf has already been created; but the error handling in udmabuf_create() will tear down the udmabuf without doing anything about the containing dma_buf. This leaves a dma_buf in memory that contains a dangling pointer; though that doesn't seem to lead to anything bad except a memory leak. Fix it by moving the dma_buf_fd() call out of export_udmabuf() so that we can give it different error handling. Note that the shape of this code changed a lot in commit 5e72b2b41a21 ("udmabuf: convert udmabuf driver to use folios"); but the memory leak seems to have existed since the introduction of udmabuf. The Linux kernel CVE team has assigned CVE-2024-56712 to this issue. Affected and fixed versions =========================== Issue introduced in 4.20 with commit fbb0de795078190a9834b3409e4b009cfb18a6d4 and fixed in 6.12.7 with commit c9fc8428d4255c2128da9c4d5cd92e554d0150cf Issue introduced in 4.20 with commit fbb0de795078190a9834b3409e4b009cfb18a6d4 and fixed in 6.13-rc4 with commit f49856f525acd5bef52ae28b7da2e001bbe7439e 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-2024-56712 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/dma-buf/udmabuf.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/c9fc8428d4255c2128da9c4d5cd92e554d0150cf https://git.kernel.org/stable/c/f49856f525acd5bef52ae28b7da2e001bbe7439e