CVE-2026-89735: usb: gadget: midi2: remove default configfs groups on teardown
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: midi2: remove default configfs groups on teardown
fmidi2allocinst() creates default configfs child groups for the default endpoint and default block using configfsadddefaultgroup(), setting their internal refcount to 1.
However, during function teardown in fmidi2freeinst() or EP cleanup in fmidi2epoptsrelease(), configfsremovedefaultgroups() is never called, therefore never dropping the refcount and leaking struct fmidi2epopts and fmidi2blockopts.
Add the missing configfsremovedefaultgroups() in the afformentioned functions to free the structs properly.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Update the midi2 teardown/cleanup path so that configfs_remove_default_groups() is called (e.g., in f_midi2_ep_opts_release(), which currently never calls it). This ensures the default configfs child groups created by f_midi2_alloc_inst() are removed on teardown, dropping the reference count and preventing struct leaks.
Linux kernel USB gadget midi2 configfs_remove_default_groups() = call configfs_remove_default_groups() during teardown
Event History
Frequently Asked Questions
How can I verify whether a kernel contains the fix?
Check whether the kernel source or history includes one of the referenced stable commits: 4beda67ee72e0c8df5b49951dd8b96f6adb25e02, a15c2acd3083461f91725760e59dff88b33c28f6, or 9ea5dfb2bfef4f8a7e704d1921d8a790cb7fb700. The provided data does not list affected or fixed kernel version ranges.
What is the operational impact of the missing cleanup?
Default configfs endpoint and block option structures remain referenced after MIDI2 function teardown or endpoint cleanup. This causes leaks of struct f_midi2_ep_opts and struct f_midi2_block_opts rather than freeing them properly.