Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D5E874FDE5C for ; Wed, 16 Sep 2026 10:42:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789555379; cv=none; b=mdhj0b8sRhJ9onchCz5U8CO8Ry4HZ3/vaZwdgjsF3JUJhQjV0PptjY6TOEyNeXg1tynZRzstzA1FDg6KbNYnQK/mBo7JeXfVuGic2zNEvPejKW1Z7+pWspABJgTdFN+uXOce/SWMt/PUPsi3HmMIKkPSKg62+RG6D98+7Ue1Iqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789555379; c=relaxed/simple; bh=h4qtMrNZbJ0Wotsn9D1LgQ6zMJHpPK3PFsq9dzOtPzY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=HxKmVtFa8+zDLJkeehTNwA4ptNf7ogXIU0adUr74a0x4y36bEpzmLgJi7bDp1tPDfzg6XZVnuWeqxKHUwA4SRhvxkYaHD7bWeFwXKm16BgRcimAjdm4EaaAyBG5m06bpAmLlS4VseAq8c2HMVUS6B8i9TjyWGJB5CCUq0SHHy44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=efW2qkqJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="efW2qkqJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA50C1F000FF; Wed, 16 Sep 2026 10:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789555374; bh=vgp93zwDSzx/hAa8Xnfaa7WY3w/PzEdQIeEe7If+Xu0=; h=From:To:Cc:Subject:Date:Reply-To; b=efW2qkqJI5/DvARuBPjNC1QG6D1fl7lwYt9ISo/LrhNUR2tCk9zUtv1duzrNiJFes knBF44fXipGgRrOWM0PgjFAB6X7o9gZhrs4pES1qvKJrioYVzRCRHZ1BhDdQgGfYTu KMh6X/43tbPwNY80j+DjcudtQVmy3K33ZP9DEDEQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-89996: dma-buf: dma-heap: don't publish fd before copy_to_user() succeeds Date: Wed, 16 Sep 2026 11:32:06 +0100 Message-ID: <2026091658-CVE-2026-89996-6ed0@gregkh> X-Mailer: git-send-email 2.55.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=4635; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=/AFNAhILDI0b9EFPVv7X/Q9+lLblurZ6h4jpvVglHgg=; b=owGbwMvMwCRo6H6F97bub03G02pJDFmr8pf/1XixwzFdg9t5jfq51dPvNq0599D0QtiBFfwCm //5yfdd6IhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJZN9jWLCvSFAw44GKQN5O jpVWUTWd55K5RRjmp6YVPalzcZjefqWojKkhyuQb2/+NAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: dma-buf: dma-heap: don't publish fd before copy_to_user() succeeds DMA_HEAP_IOCTL_ALLOC allocates a dma-buf and installs an fd into the caller's fd table via dma_buf_fd() -> fd_install() before dma_heap_ioctl() copies the result back to userspace. If the trailing copy_to_user() fails, userspace never learns the fd number, but the fd (and the underlying dma-buf reference) are already visible to other threads in the same process and are leaked for the lifetime of the process. The obvious "close it on the failure path" fix is unsafe: once fd_install() has run, another thread can already dup() the fd, send it via SCM_RIGHTS, or close() it and let its number be reused, so a subsequent close_fd() from the ioctl path can operate on an unrelated file. This was pointed out by Christian König on v1 [1]. Restructure the allocation path so that fd_install() is the last, unfailable step of a successful ioctl: 1. heap->ops->allocate() creates the dma_buf. 2. get_unused_fd_flags() reserves an fd number in the caller's fd table without publishing it, so no other thread can observe it. 3. copy_to_user() delivers the fd number to userspace; on failure the fd is returned with put_unused_fd() and the dma_buf reference is dropped with dma_buf_put(), leaving no user- visible state behind. 4. dma_buf_fd_install() publishes the fd and emits the trace_dma_buf_fd tracepoint -- from here on the ioctl cannot fail. A new dma_buf_fd_install() helper is introduced in dma-buf.c to wrap fd_install() together with the DMA_BUF_TRACE() call, preserving the export tracing that dma_buf_fd() provides. dma_heap_ioctl_allocate() is refactored to return the struct dma_buf * directly (returning ERR_PTR on failure) so the caller holds the dmabuf reference across steps 3 and 4. The failure at step 3 is easily reachable from userspace: pass a struct dma_heap_allocation_data that lives in a page whose protection is flipped to PROT_READ between copy_from_user() and copy_to_user() (e.g. via mprotect()). Before this change each such ioctl leaks one dmabuf fd; after it, the fd table is unchanged on failure and only /dev/dma_heap/ remains open. No UAPI or heap-driver interface change. [1] https://lore.kernel.org/dri-devel/175e98de-f414-47d7-81c1-c0fe0a8f7f62@amd.com/ The Linux kernel CVE team has assigned CVE-2026-89996 to this issue. Affected and fixed versions =========================== Issue introduced in 5.6 with commit c02a81fba74fe3488ad6b08bfb5a1329005418f8 and fixed in 6.18.52 with commit 69d57dbadb27ffd5eef34fd184bab145500cdabc Issue introduced in 5.6 with commit c02a81fba74fe3488ad6b08bfb5a1329005418f8 and fixed in 7.2.5 with commit 0d4a5d218055db29b50cc07d3d73d27007c2a391 Issue introduced in 5.6 with commit c02a81fba74fe3488ad6b08bfb5a1329005418f8 and fixed in 7.3-rc2 with commit 30d0aff2c65a277135cfd8ea28fa1ee75e0ea4e0 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-2026-89996 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/dma-buf.c drivers/dma-buf/dma-heap.c include/linux/dma-buf.h 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/69d57dbadb27ffd5eef34fd184bab145500cdabc https://git.kernel.org/stable/c/0d4a5d218055db29b50cc07d3d73d27007c2a391 https://git.kernel.org/stable/c/30d0aff2c65a277135cfd8ea28fa1ee75e0ea4e0