From mboxrd@z Thu Jan 1 00:00:00 1970 From: AL-KERNEL To: kernel-cve@kernelcve.org Subject: [CVE-2026-63894][MODERATE 7.0] usb: gadget: f_fs: serialize DMABUF cancel against request completion Date: Sun, 19 Jul 2026 20:43:02 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-AL-KERNEL-CVE: CVE-2026-63894 X-AL-KERNEL-Priority: MODERATE 7.0 X-AL-KERNEL-Severity: MODERATE 7.0 X-AL-KERNEL-Base-Severity: MODERATE X-AL-KERNEL-KPANIC: YES X-AL-KERNEL-ActionableScore: 5 X-AL-KERNEL-ActionableScore-Lower: 4 X-AL-KERNEL-Commit: c872d8a065b3b499ce4c3ad168b5d34b68524f66 List-Id: CVE: CVE-2026-63894 Priority: MODERATE 7.0 AL-KERNEL base severity: MODERATE KPANIC flag: YES Patch: usb: gadget: f_fs: serialize DMABUF cancel against request completion Commit: c872d8a065b3b499ce4c3ad168b5d34b68524f66 Upstream patch: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c872d8a065b3b499ce4c3ad168b5d34b68524f66 Original CVE announcement: https://lore.kernel.org/linux-cve-announce/?q=CVE-2026-63894 Analysis date: Sun, 19 Jul 2026 20:43:02 -0400 ActionableScore: 5 ActionableScore lower bound: 4 Actionable bucket: Strong Important candidate / Actionable Moderate at minimum Manual review required: YES Summary: A stale usb_request pointer in USB gadget FunctionFS DMABUF handling can survive request completion and later be passed to usb_ep_dequeue() from detach or close paths, causing a local UAF-triggered kernel crash with limited but nonzero manual-review concern for stronger memory corruption impact. ====================================================================== ABOUT THIS REPORT ====================================================================== The original Linux kernel CVE announcement for CVE-2026-63894 is available here: https://lore.kernel.org/linux-cve-announce/?q=CVE-2026-63894 The original announcement does not normally provide a security severity estimate, CVSS assessment, or enough information to determine whether the reported kernel bug represents a practically relevant security issue. This report was generated by AL-KERNEL, an AI-assisted Linux kernel vulnerability analysis system developed by Alexander Larkin. It combines an autonomous classifier with LLM-assisted technical analysis and a separate ActionableScore mechanism. The purpose of this report is to prioritize Linux kernel CVEs before manual review, identify cases that require prompt investigation, and support automatic closure of issues that are unlikely to have meaningful security impact. Published priority for this report: MODERATE 7.0 Manual review required: YES A detailed explanation of the methodology and priority rules is included at the end of this message. ====================================================================== AL-KERNEL CLASSIFICATION RESULT ====================================================================== CVE-2026-63894 MODERATE CHECK WITH IMPACT FROM ORIG NN LOW Maybe valid. Check manually. Hints by AL-KERNEL: The best (paranoid) CVSS is 'AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H';*CWE-416;CWE-362;CWE-667;Other CVSS 'AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H';BEST CVSS score: '7';DESCR 'A use-after-free can occur in the USB gadget FunctionFS DMABUF path because a completed usb_request may be freed while the attachment state still keeps a stale request pointer for later cancel operations. A local gadget service can trigger the stale pointer through FUNCTIONFS_DMABUF_DETACH or close after request completion, causing usb_ep_dequeue() to receive a freed request. For the CVSS the PR:L is used because real deployments may delegate FunctionFS access to a less privileged gadget daemon rather than full root. The issue is not reachable from a USB host on the cable and is not a remote network attack. Impact is at least local denial of service via kernel crash. In the paranoid interpretation, the UAF in an in-kernel request object may allow confidentiality or integrity impact and should be reviewed manually.';YES REQUIRES MANUAL CHECK; ,and ActionableScore result is Strong Important candidate / Actionable Moderate at minimum (with actual score 5) SKIP CVE-2026-63894 UNKNOWN SKIP No affected files built, so skip this CVE NO - - unknown MAYBE LOCK USB INIT RACE ERRORPATH UAF HARDWARE LINUS KPANIC MEMORY - - checked ====================================================================== ACTIONABLESCORE ANALYSIS ====================================================================== ActionableScore=5 ActionableScoreLower=4 ## 1. ActionableScore * Conservative score: 4 * Paranoid score: 5 * Final recommended bucket: **Strong Important candidate / Actionable Moderate at minimum**:: ## 2. Signal breakdown * Local delegated trigger: +1. The bug is reachable through the FunctionFS device node by a local gadget service. It is not generally reachable by arbitrary unprivileged users, but FunctionFS can be delegated via uid, gid, and fmode to a non-root daemon. * Memory corruption, weak or indirect corruption candidate: +1. This is a stale usb_request pointer passed to usb_ep_dequeue() after free. The patch shows UAF, but not attacker-controlled reclaim, overwrite, type confusion, or callback control. * Real lifetime corruption: +1. The core issue is an async completion versus cancel or close lifetime mismatch, with priv->req surviving after usb_ep_free_request(). * Reliable kernel crash / strong DoS: +1. The commit describes KASAN-reproducible stale-pointer access on detach and close paths, and real UDC drivers dereference the request immediately. * Privileged kernel/device-management lifetime path: +1 for paranoid scoring. The bug is in USB gadget request lifetime management and affects UDC dequeue paths, but attacker control is limited. * Race / lifetime-window constraint: -1 for conservative interpretation. Reliable exploitation beyond crash depends on timing and object lifetime behavior, and no reclaim primitive is shown. ## 3. Reachability analysis The trigger is local through FunctionFS DMABUF operations, especially FUNCTIONFS_DMABUF_DETACH or close after request completion. It is not reachable from a USB host over the cable and is not network reachable. In typical deployments the FunctionFS node is owned by a privileged gadget daemon such as adbd or a composite gadget service. However, FunctionFS supports uid, gid, and fmode delegation, so a reduced-privilege service account may be able to trigger it without full host root. Containers and namespaces only matter if the FunctionFS device node is delegated into that environment. The path is configuration dependent and requires USB gadget FunctionFS DMABUF usage, so exposure is narrower than a default local syscall path. Call-site confidence: high. The commit and diff show the completion path, cleanup path, transfer path, stale priv->req, and cancel-side usb_ep_dequeue() consequence. ## 4. Severity interpretation This is more than an ordinary Moderate because the patch fixes a real kernel object lifetime bug with a freed usb_request later passed into UDC driver code. Realistic impact is most strongly local DoS via kernel crash. Theoretical privilege escalation is not demonstrated because the patch does not show attacker-controlled reclaim, write-after-free, type confusion, callback dispatch, or refcount takeover. Therefore the conservative score stays borderline manual-review territory, while the paranoid score reaches Actionable Moderate due to UAF in a device-management lifetime path. ## 5. One-sentence report phrase A stale usb_request pointer in USB gadget FunctionFS DMABUF handling can survive request completion and later be passed to usb_ep_dequeue() from detach or close paths, causing a local UAF-triggered kernel crash with limited but nonzero manual-review concern for stronger memory corruption impact. ## 6. Manual review recommendation MANUAL CHECK REQUIRED. Reason: the patch explicitly fixes a UAF-style lifetime bug in a kernel request object, and some in-tree UDC dequeue paths dereference the freed request immediately. Exploitation beyond DoS is not proven, but the object-lifetime class and delegated local service reachability justify manual review rather than autoclose. ====================================================================== UPSTREAM PATCH SUMMARY ====================================================================== Patch: usb: gadget: f_fs: serialize DMABUF cancel against request completion Commit: c872d8a065b3b499ce4c3ad168b5d34b68524f66 Upstream URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c872d8a065b3b499ce4c3ad168b5d34b68524f66 Commit description: ffs_epfile_dmabuf_io_complete() calls usb_ep_free_request() on the completed request but leaves priv->req, the back-pointer that ffs_dmabuf_transfer() set on submission, pointing at the freed memory. A later FUNCTIONFS_DMABUF_DETACH ioctl or ffs_epfile_release() on the close path still sees priv->req non-NULL under ffs->eps_lock: if (priv->ep && priv->req) usb_ep_dequeue(priv->ep, priv->req); so usb_ep_dequeue() is called on a freed usb_request. On dummy_hcd the dequeue path only walks a live queue and pointer-compares, so the freed pointer reads without faulting and KASAN requires an explicit check at the FunctionFS call site to surface the use-after-free. On SG-capable in-tree UDCs the dequeue path dereferences the supplied request immediately: * chipidea's ep_dequeue() does container_of(req, struct ci_hw_req, req) and reads hwreq->req.status before acquiring its own lock. * cdnsp's cdnsp_gadget_ep_dequeue() reads request->status first. The narrower option of clearing priv->req via cmpxchg() in the completion does not close the race: the completion runs without eps_lock, so a cancel path holding eps_lock can still observe priv->req non-NULL, race a concurrent completion that clears and frees, and pass the freed pointer to usb_ep_dequeue(). A slightly longer fix that moves the free into the cleanup work is needed. Same class of lifetime race as the recent usbip-vudc timer fix [1]. Take eps_lock in the sole place that mutates priv->req from the callback direction by moving usb_ep_free_request() out of the completion into ffs_dmabuf_cleanup(), the existing work handler scheduled by ffs_dmabuf_signal_done() on ffs->io_completion_wq. Clear priv->req there under eps_lock before freeing, and only clear if priv->req still names our request (a subsequent ffs_dmabuf_transfer() on the same attachment may have queued a new one). This keeps the existing dummy_hcd sync-dequeue invariant: the completion callback is still invoked by the UDC without eps_lock held (dummy_hcd drops its own lock before calling the callback), and the callback now takes no f_fs lock at all. Serialization against the cancel path happens in cleanup, which runs from the workqueue with no f_fs lock held on entry. The priv ref count protects the containing ffs_dmabuf_priv: ffs_dmabuf_transfer() takes a ref via ffs_dmabuf_get(), cleanup drops it via ffs_dmabuf_put(), so priv stays live for the cleanup even after the cancel path's list_del + ffs_dmabuf_put. The ffs_dmabuf_transfer() error path no longer frees usb_req inline: fence->req and fence->ep are set before usb_ep_queue(), so ffs_dmabuf_cleanup() (scheduled by the error-path ffs_dmabuf_signal_done()) owns the free regardless of whether the queue succeeded. Reproduced under KASAN on both detach and close paths against dummy_hcd with an observability hook (kasan_check_byte(priv->req) immediately before usb_ep_dequeue) at the two FunctionFS cancel sites to surface the stale-pointer access; the hook is not part of this patch. The KASAN allocator / free stacks in the captured splats identify the same request: alloc in dummy_alloc_request, free in dummy_timer, fault reached from ffs_epfile_release (close) and from the FUNCTIONFS_DMABUF_DETACH ioctl (detach). With the patch applied, both paths are silent under the same hook. The bug is reached from the FunctionFS device node, which in real deployments is owned by the privileged gadget daemon (adbd, UMS, composite gadget services, etc.); it is not reachable from unprivileged userspace or from a USB host on the cable. FunctionFS mounts default to GLOBAL_ROOT_UID, but the filesystem supports uid=, gid=, and fmode= delegation to a non-root gadget daemon, so on real deployments the attacker may be a less-privileged service rather than root. Fixes: 7b07a2a ("usb: gadget: functionfs: Add DMABUF import interface") [Commit description truncated; see the upstream URL below] Changed files: drivers/usb/gadget/function/f_fs.c Diff excerpt: Not included in this email. See the upstream URL for the full patch. Full patch: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c872d8a065b3b499ce4c3ad168b5d34b68524f66 ====================================================================== DETAILED REPORT METHODOLOGY ====================================================================== The original Linux kernel CVE announcement for CVE-2026-63894 can be found here: https://lore.kernel.org/linux-cve-announce/?q=CVE-2026-63894 The original CVE announcement normally does not include a security-level estimate. In particular, it may not contain a CVSS assessment, an impact level, or enough information to determine whether the reported bug is a practically relevant security issue. One purpose of this parallel CVE list is to provide that missing technical and prioritization information. The original goal of the AL-KERNEL project was to prioritize Linux kernel CVE analysis automatically before manual review. The system can also help identify non-security issues that may be suitable for automatic closure. This report was generated by AL-KERNEL, an AI-assisted Linux kernel vulnerability analysis system developed by Alexander Larkin. The first analysis stage combines an autonomous classifier with additional LLM-based analysis. The autonomous classifier runs locally on a CPU and is based on a backpropagation neural network. Together, these mechanisms produce a technical vulnerability description, identify likely weakness types, estimate CVSS severity, and provide input for ActionableScore. Two CVSS estimates are retained because incomplete kernel vulnerability information often permits more than one defensible interpretation: Conservative CVSS vector: AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H The Best / paranoid CVSS vector: AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H The Best / paranoid CVSS score: 7 The conservative vector represents a lower-impact interpretation. The Best/paranoid vector intentionally represents a plausible upper-bound interpretation and should not automatically be treated as demonstrated real-world impact. CVSS may also need to be adjusted for a particular Linux deployment, because actual reachability, privileges, enabled kernel configuration, hardware, namespaces, exposed device nodes, and other environmental conditions can differ significantly between systems. A separate ActionableScore mechanism evaluates practical remediation urgency. Its analysis may include reachability, attack prerequisites, subsystem exposure, memory-corruption characteristics, denial-of-service reliability, and possible confidentiality, integrity, or privilege-escalation impact. Conservative ActionableScore: 4 Paranoid ActionableScore: 5 The final base severity is taken directly from the second tab-separated field of the AL-KERNEL classification result. ActionableScore does not replace or independently override that final AL-KERNEL decision, and if ActionableScore adjusted impact level of ALKERNEL, then you would see self-readable flags above like INCREASED_TO_HIGH_BASED_ON_ACTIONABLESCOREHIGHEREQTHAN7. For an AL-KERNEL result of MODERATE, this report uses the following additional presentation split: ActionableScore below 5 -> MODERATE REGULAR ActionableScore 5 or more -> MODERATE 7.0 The distinction between MODERATE REGULAR and MODERATE 7.0 makes it possible to identify Moderate issues that should receive manual analysis and fixes before lower-priority MODERATE REGULAR issues. In many cases, MODERATE REGULAR fixes may wait for a later rebase or routine update. There is one override in which MODERATE REGULAR becomes MODERATE 7.0 even when the ActionableScore is below 5. When the AL-KERNEL result contains the KPANIC flag, a MODERATE result is always presented as MODERATE 7.0. The KPANIC flag selected with few regexps without usage of AI at all, so it helps to detect cases when Kernel Crash happens and similar (to filter False-Negative results from the LLM usage). KPANIC indicates that a reliable kernel crash, kernel panic, or similarly serious kernel availability impact was identified by the classification workflow. AL-KERNEL base severity for this report: MODERATE KPANIC detected for this report: YES Published priority for this report (same as in Subject): MODERATE 7.0 These results are intended to support engineering triage. They are machine-generated estimates, and cases marked for manual review should be validated by a human security engineer before final disposition. For more info read docs linked from here: https://kernelcve.org/ (and you can submit you own patch there to generate such a report for non-existant CVE-id yet). Note that in many cases this AI tool selects higher severity, than real is (means you can expect Importants instead of Moderate 7.0 or Moderates 7.0 instead of regular Moderates). If you see such cases, please use reply email interface to add additional manual analyses info to this particular CVE. And please, please, let me know when you see Lows instead of Importants or Important instead of Low (because particular for such cases I need to tune this AI tool to make it better for this one and next similar). My contact email for such notifications is alexanjelausa@gmail.com (and both send reply to CVE record itself too and see "reply" button below for howto reply).