{"id":"CVE-2025-71074","state":"PUBLISHED","title":"functionfs: fix the open/removal races","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nfunctionfs: fix the open/removal races\n\nffs_epfile_open() can race with removal, ending up with file->private_data\npointing to freed object.\n\nThere is a total count of opened files on functionfs (both ep0 and\ndynamic ones) and when it hits zero, dynamic files get removed.\nUnfortunately, that removal can happen while another thread is\nin ffs_epfile_open(), but has not incremented the count yet.\nIn that case open will succeed, leaving us with UAF on any subsequent\nread() or write().\n\nThe root cause is that ffs->opened is misused; atomic_dec_and_test() vs.\natomic_add_return() is not a good idea, when object remains visible all\nalong.\n\nTo untangle that\n\t* serialize openers on ffs->mutex (both for ep0 and for dynamic files)\n\t* have dynamic ones use atomic_inc_not_zero() and fail if we had\nzero ->opened; in that case the file we are opening is doomed.\n\t* have the inodes of dynamic files marked on removal (from the\ncallback of simple_recursive_removal()) - clear ->i_private there.\n\t* have open of dynamic ones verify they hadn't been already removed,\nalong with checking that state is FFS_ACTIVE.","publishedAt":"2026-01-13T15:31:27.413Z","updatedAt":"2026-10-21T12:38:33.246Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ddf8abd2599491cbad959c700b90ba72a5dce8d0","status":"affected","lessThan":"585a656283c954337036422afcd9cb70dd4135e7","versionType":"git"},{"version":"ddf8abd2599491cbad959c700b90ba72a5dce8d0","status":"affected","lessThan":"75240e5e51c6e6d67a3039384125fa54259a3926","versionType":"git"},{"version":"ddf8abd2599491cbad959c700b90ba72a5dce8d0","status":"affected","lessThan":"e5bf5ee266633cb18fff6f98f0b7d59a62819eee","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/function/f_fs.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.35","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.35","versionType":"semver"},{"version":"6.6.160","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.114","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.19","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/function/f_fs.c"]}],"references":["https://git.kernel.org/stable/c/585a656283c954337036422afcd9cb70dd4135e7","https://git.kernel.org/stable/c/75240e5e51c6e6d67a3039384125fa54259a3926","https://git.kernel.org/stable/c/e5bf5ee266633cb18fff6f98f0b7d59a62819eee"],"weaknesses":[],"ingestedAt":"2026-10-29T20:10:04.440Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/71xxx/CVE-2025-71074.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-71074","state":"PUBLISHED","datePublished":"2026-01-13T15:31:27.413Z","dateUpdated":"2026-10-21T12:38:33.246Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-01-13T15:30:19.647Z"},"containers":{"cna":{"title":"functionfs: fix the open/removal races","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nfunctionfs: fix the open/removal races\n\nffs_epfile_open() can race with removal, ending up with file->private_data\npointing to freed object.\n\nThere is a total count of opened files on functionfs (both ep0 and\ndynamic ones) and when it hits zero, dynamic files get removed.\nUnfortunately, that removal can happen while another thread is\nin ffs_epfile_open(), but has not incremented the count yet.\nIn that case open will succeed, leaving us with UAF on any subsequent\nread() or write().\n\nThe root cause is that ffs->opened is misused; atomic_dec_and_test() vs.\natomic_add_return() is not a good idea, when object remains visible all\nalong.\n\nTo untangle that\n\t* serialize openers on ffs->mutex (both for ep0 and for dynamic files)\n\t* have dynamic ones use atomic_inc_not_zero() and fail if we had\nzero ->opened; in that case the file we are opening is doomed.\n\t* have the inodes of dynamic files marked on removal (from the\ncallback of simple_recursive_removal()) - clear ->i_private there.\n\t* have open of dynamic ones verify they hadn't been already removed,\nalong with checking that state is FFS_ACTIVE."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ddf8abd2599491cbad959c700b90ba72a5dce8d0","status":"affected","lessThan":"585a656283c954337036422afcd9cb70dd4135e7","versionType":"git"},{"version":"ddf8abd2599491cbad959c700b90ba72a5dce8d0","status":"affected","lessThan":"75240e5e51c6e6d67a3039384125fa54259a3926","versionType":"git"},{"version":"ddf8abd2599491cbad959c700b90ba72a5dce8d0","status":"affected","lessThan":"e5bf5ee266633cb18fff6f98f0b7d59a62819eee","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/function/f_fs.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.35","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.35","versionType":"semver"},{"version":"6.6.160","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.114","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.19","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/function/f_fs.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/585a656283c954337036422afcd9cb70dd4135e7"},{"url":"https://git.kernel.org/stable/c/75240e5e51c6e6d67a3039384125fa54259a3926"},{"url":"https://git.kernel.org/stable/c/e5bf5ee266633cb18fff6f98f0b7d59a62819eee"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The race is reached through local open, close, read, write, or ioctl operations on FunctionFS endpoint files. A USB host cannot directly invoke ffs_epfile_open(), so this is local rather than physical or network access.\nAC:L - The attacker can race opening a dynamic endpoint against closing the sole remaining ep0 descriptor and repeat the attempt with controlled threads. Both race sides and the freed allocation's endpoint-controlled size are attacker-controlled.\nPR:L - Mounting FunctionFS requires CAP_SYS_ADMIN in the initial user namespace, but endpoint opening has no capability check and uid/gid/fmode options permit delegation to non-root service accounts, as in [AOSP FunctionFS mounts](https://android.googlesource.com/device/google/gs201/%2B/587 5d29f/conf/init.gs201.usb.rc). A low-privileged local account with delegated endpoint access can therefore trigger the race.\nUI:N - The attacker independently performs endpoint configuration, concurrent open and close operations, and subsequent use of the stale descriptor without victim interaction.\nS:U - Exploitation corrupts memory within the kernel's existing security authority and constitutes ordinary local kernel compromise rather than crossing a VM or IOMMU boundary.\nC:H - The attacker-sized heap object contains numerous pointers and can be reclaimed before stale read, ioctl, or release operations, making kernel-memory disclosure through the UAF defensible.\nI:H - The stale object reaches mutex and list operations, atomic modification, xchg and kfree operations, and USB request handling, providing plausible arbitrary-write, arbitrary-free, and control-flow-hijacking primitives.\nA:H - Dereferencing the freed object, locking reclaimed mutexes, freeing attacker-influenced pointers, or triggering warnings under panic-on-warn can crash or panic the kernel."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-10-21T12:38:33.246Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.6.160"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.12.114"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.19"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}