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 A150B3009EA for ; Tue, 13 Jan 2026 15:32:13 +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=1768318333; cv=none; b=pBHqnjUVSlnkVKptOdrIrvfDSvNE7Uea2U/WxYp285ythEUqNh79FHCYO5fGTcczTvqnrbypAiDPIFsCiOxGCHLHwk4cuuRiuPq9iuMmZd160ZGfazzSFdt5gsyMcKzo+pqcnT1dh0AIlkfwPnk89GFbcTLeNZPnvlFRSBeJTOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768318333; c=relaxed/simple; bh=EAYT7IybQe4SExqOa6Vpu6shDDAxj1WOK3mQLXWtukE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=R09/UmxfgzUxCYIDwsQsufVp7yLXD5tVQuxv3q47jDGjOvzV8PETvoGuphlJeMvbKPIcxtflMkZcQE2LrvvtuKGy7L/OaW1RMlPhpDutq+MdgFY2bcKq0u+tjgJ2cLZ8ZlhQUZSiP3G0ZrE7IQMANlalgy8e3ps1bOFFcPvXTfg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=muo1SDuK; 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="muo1SDuK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D42CC116C6; Tue, 13 Jan 2026 15:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768318333; bh=EAYT7IybQe4SExqOa6Vpu6shDDAxj1WOK3mQLXWtukE=; h=From:To:Cc:Subject:Date:Reply-To:From; b=muo1SDuKbkSjc1EIRh9I6eBgjEQiekLVSYijepPr6AVQ3t3NHBOHKK/f+nDB6jXj0 t/qWZQg8g9h8fpkt5vptniKo8skJsnuXP+5cia7n9xf10h5PtrIyyFI4Jd/QvdvNUf Vp4EcseF1Qb4er8Ty/nujzG1Pa+N7ApLfY+GgmB8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-71074: functionfs: fix the open/removal races Date: Tue, 13 Jan 2026 16:31:32 +0100 Message-ID: <2026011326-CVE-2025-71074-f3ed@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=2681; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=wUTWoz/xbDkT9kTv+G8h9wYbrH8Xtb5JhhWVPmnrv/M=; b=owGbwMvMwCRo6H6F97bub03G02pJDJlpqX5PRW4a/1jOuWltTZnJ3ln9i51am+w3qz2a9CsvR mF9AseujlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjI4T6GBRMFc5SDz//g03jw eNLX+zF8Jq7azxhms7wI+lEm8NW1pEzXVnS38n/+Lj4JAA== 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: functionfs: fix the open/removal races ffs_epfile_open() can race with removal, ending up with file->private_data pointing to freed object. There is a total count of opened files on functionfs (both ep0 and dynamic ones) and when it hits zero, dynamic files get removed. Unfortunately, that removal can happen while another thread is in ffs_epfile_open(), but has not incremented the count yet. In that case open will succeed, leaving us with UAF on any subsequent read() or write(). The root cause is that ffs->opened is misused; atomic_dec_and_test() vs. atomic_add_return() is not a good idea, when object remains visible all along. To untangle that * serialize openers on ffs->mutex (both for ep0 and for dynamic files) * have dynamic ones use atomic_inc_not_zero() and fail if we had zero ->opened; in that case the file we are opening is doomed. * have the inodes of dynamic files marked on removal (from the callback of simple_recursive_removal()) - clear ->i_private there. * have open of dynamic ones verify they hadn't been already removed, along with checking that state is FFS_ACTIVE. The Linux kernel CVE team has assigned CVE-2025-71074 to this issue. Affected and fixed versions =========================== Fixed in 6.18.3 with commit b49c766856fb5901490de577e046149ebf15e39d Fixed in 6.19-rc1 with commit e5bf5ee266633cb18fff6f98f0b7d59a62819eee 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-2025-71074 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/usb/gadget/function/f_fs.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/b49c766856fb5901490de577e046149ebf15e39d https://git.kernel.org/stable/c/e5bf5ee266633cb18fff6f98f0b7d59a62819eee