{"api_version":"1","generated_at":"2026-11-30T18:56:04+00:00","cve":"CVE-2026-139416","urls":{"html":"https://cve.report/CVE-2026-139416","api":"https://cve.report/api/cve/CVE-2026-139416.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-139416","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-139416"},"summary":{"title":"ALSA: rawmidi: Drain input work before freeing the runtime","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nALSA: rawmidi: Drain input work before freeing the runtime\n\nThe input runtime embeds event_work, so the work must be drained before\nclose_substream() frees the runtime. The cancellation in\nsnd_rawmidi_input_trigger() runs before close clears substream->opened,\nleaving a window for snd_rawmidi_receive() to enqueue more work.\n\nWith a sequencer subscription to a USB MIDI input port, an in-flight\ncompletion can overlap the last subscription's midisynth_unsubscribe():\n\n1. snd_usbmidi_input_data() observes input_triggered and is delayed\n   before calling snd_rawmidi_receive().\n2. Unsubscribe enters close_substream(), clears input_triggered through\n   the provider trigger callback and returns from cancel_work_sync().\n   The substream is still opened.\n3. The completion resumes. snd_rawmidi_receive() takes substream->lock,\n   sees opened set and queues runtime->event_work before dropping the\n   lock.\n4. Close clears opened under that lock, closes the provider and frees\n   the runtime. Stopping USB URBs does not drain the raw-MIDI work.\n5. The queued work runs and snd_rawmidi_input_event_work() reads event\n   or substream from the freed runtime, causing a use-after-free.\n\nCancel input event_work again after clearing opened, before closing the\nprovider or releasing the runtime's private data. Receive holds\nsubstream->lock through its opened check and work enqueue, so once close\nhas cleared opened under that lock, no further receive can queue work.\nThe final cancellation therefore drains any late work before the\nruntime is freed. Keep it outside the spinlock so a running callback can\nfinish.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-30 14:19:10","updated_at":"2026-11-30 14:19:10"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/b8824d0fb9e515d9b0d5be78b4acc99f02981151","name":"https://git.kernel.org/stable/c/b8824d0fb9e515d9b0d5be78b4acc99f02981151","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/31fe24f97c1046ac0219b625eb5008ef31923e7b","name":"https://git.kernel.org/stable/c/31fe24f97c1046ac0219b625eb5008ef31923e7b","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/16ef7ce9f01ea9950b2186c48b14538dcb87da61","name":"https://git.kernel.org/stable/c/16ef7ce9f01ea9950b2186c48b14538dcb87da61","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/8c3529f0a8faaac7d73333486f69da1617ecc579","name":"https://git.kernel.org/stable/c/8c3529f0a8faaac7d73333486f69da1617ecc579","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/48f7120813e8509dce98b4dd27c39ca80149d150","name":"https://git.kernel.org/stable/c/48f7120813e8509dce98b4dd27c39ca80149d150","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/d2ee58c9cc55dc5f8a4b6e076d0dd29e55528ef9","name":"https://git.kernel.org/stable/c/d2ee58c9cc55dc5f8a4b6e076d0dd29e55528ef9","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/b4449d6b58b8a84ae1706775863f472765463bce","name":"https://git.kernel.org/stable/c/b4449d6b58b8a84ae1706775863f472765463bce","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-139416","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139416","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b3c705aa9e9147a30009bdf6ba853aa7fe138e58 d2ee58c9cc55dc5f8a4b6e076d0dd29e55528ef9 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b3c705aa9e9147a30009bdf6ba853aa7fe138e58 31fe24f97c1046ac0219b625eb5008ef31923e7b git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b3c705aa9e9147a30009bdf6ba853aa7fe138e58 b4449d6b58b8a84ae1706775863f472765463bce git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b3c705aa9e9147a30009bdf6ba853aa7fe138e58 16ef7ce9f01ea9950b2186c48b14538dcb87da61 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b3c705aa9e9147a30009bdf6ba853aa7fe138e58 48f7120813e8509dce98b4dd27c39ca80149d150 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b3c705aa9e9147a30009bdf6ba853aa7fe138e58 b8824d0fb9e515d9b0d5be78b4acc99f02981151 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected b3c705aa9e9147a30009bdf6ba853aa7fe138e58 8c3529f0a8faaac7d73333486f69da1617ecc579 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3.1","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 3.1 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.10.275 5.10.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.15.226 5.15.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.6.163 6.6.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.119 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18.65 6.18.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3.6 7.3.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.4-rc1 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["sound/core/rawmidi.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"d2ee58c9cc55dc5f8a4b6e076d0dd29e55528ef9","status":"affected","version":"b3c705aa9e9147a30009bdf6ba853aa7fe138e58","versionType":"git"},{"lessThan":"31fe24f97c1046ac0219b625eb5008ef31923e7b","status":"affected","version":"b3c705aa9e9147a30009bdf6ba853aa7fe138e58","versionType":"git"},{"lessThan":"b4449d6b58b8a84ae1706775863f472765463bce","status":"affected","version":"b3c705aa9e9147a30009bdf6ba853aa7fe138e58","versionType":"git"},{"lessThan":"16ef7ce9f01ea9950b2186c48b14538dcb87da61","status":"affected","version":"b3c705aa9e9147a30009bdf6ba853aa7fe138e58","versionType":"git"},{"lessThan":"48f7120813e8509dce98b4dd27c39ca80149d150","status":"affected","version":"b3c705aa9e9147a30009bdf6ba853aa7fe138e58","versionType":"git"},{"lessThan":"b8824d0fb9e515d9b0d5be78b4acc99f02981151","status":"affected","version":"b3c705aa9e9147a30009bdf6ba853aa7fe138e58","versionType":"git"},{"lessThan":"8c3529f0a8faaac7d73333486f69da1617ecc579","status":"affected","version":"b3c705aa9e9147a30009bdf6ba853aa7fe138e58","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["sound/core/rawmidi.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"3.1"},{"lessThan":"3.1","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"5.10.*","status":"unaffected","version":"5.10.275","versionType":"semver"},{"lessThanOrEqual":"5.15.*","status":"unaffected","version":"5.15.226","versionType":"semver"},{"lessThanOrEqual":"6.6.*","status":"unaffected","version":"6.6.163","versionType":"semver"},{"lessThanOrEqual":"6.12.*","status":"unaffected","version":"6.12.119","versionType":"semver"},{"lessThanOrEqual":"6.18.*","status":"unaffected","version":"6.18.65","versionType":"semver"},{"lessThanOrEqual":"7.3.*","status":"unaffected","version":"7.3.6","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.4-rc1","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.10.275","versionStartIncluding":"3.1","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.15.226","versionStartIncluding":"3.1","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.6.163","versionStartIncluding":"3.1","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.119","versionStartIncluding":"3.1","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.65","versionStartIncluding":"3.1","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.6","versionStartIncluding":"3.1","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1","versionStartIncluding":"3.1","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nALSA: rawmidi: Drain input work before freeing the runtime\n\nThe input runtime embeds event_work, so the work must be drained before\nclose_substream() frees the runtime. The cancellation in\nsnd_rawmidi_input_trigger() runs before close clears substream->opened,\nleaving a window for snd_rawmidi_receive() to enqueue more work.\n\nWith a sequencer subscription to a USB MIDI input port, an in-flight\ncompletion can overlap the last subscription's midisynth_unsubscribe():\n\n1. snd_usbmidi_input_data() observes input_triggered and is delayed\n   before calling snd_rawmidi_receive().\n2. Unsubscribe enters close_substream(), clears input_triggered through\n   the provider trigger callback and returns from cancel_work_sync().\n   The substream is still opened.\n3. The completion resumes. snd_rawmidi_receive() takes substream->lock,\n   sees opened set and queues runtime->event_work before dropping the\n   lock.\n4. Close clears opened under that lock, closes the provider and frees\n   the runtime. Stopping USB URBs does not drain the raw-MIDI work.\n5. The queued work runs and snd_rawmidi_input_event_work() reads event\n   or substream from the freed runtime, causing a use-after-free.\n\nCancel input event_work again after clearing opened, before closing the\nprovider or releasing the runtime's private data. Receive holds\nsubstream->lock through its opened check and work enqueue, so once close\nhas cleared opened under that lock, no further receive can queue work.\nThe final cancellation therefore drains any late work before the\nruntime is freed. Keep it outside the spinlock so a running callback can\nfinish."}],"providerMetadata":{"dateUpdated":"2026-11-30T13:34:33.192Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/d2ee58c9cc55dc5f8a4b6e076d0dd29e55528ef9"},{"url":"https://git.kernel.org/stable/c/31fe24f97c1046ac0219b625eb5008ef31923e7b"},{"url":"https://git.kernel.org/stable/c/b4449d6b58b8a84ae1706775863f472765463bce"},{"url":"https://git.kernel.org/stable/c/16ef7ce9f01ea9950b2186c48b14538dcb87da61"},{"url":"https://git.kernel.org/stable/c/48f7120813e8509dce98b4dd27c39ca80149d150"},{"url":"https://git.kernel.org/stable/c/b8824d0fb9e515d9b0d5be78b4acc99f02981151"},{"url":"https://git.kernel.org/stable/c/8c3529f0a8faaac7d73333486f69da1617ecc579"}],"title":"ALSA: rawmidi: Drain input work before freeing the runtime","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-139416","datePublished":"2026-11-30T13:34:33.192Z","dateReserved":"2026-11-30T13:22:15.932Z","dateUpdated":"2026-11-30T13:34:33.192Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-30 14:19:10","lastModifiedDate":"2026-11-30 14:19:10","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"139416","Ordinal":"1","Title":"ALSA: rawmidi: Drain input work before freeing the runtime","CVE":"CVE-2026-139416","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"139416","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nALSA: rawmidi: Drain input work before freeing the runtime\n\nThe input runtime embeds event_work, so the work must be drained before\nclose_substream() frees the runtime. The cancellation in\nsnd_rawmidi_input_trigger() runs before close clears substream->opened,\nleaving a window for snd_rawmidi_receive() to enqueue more work.\n\nWith a sequencer subscription to a USB MIDI input port, an in-flight\ncompletion can overlap the last subscription's midisynth_unsubscribe():\n\n1. snd_usbmidi_input_data() observes input_triggered and is delayed\n   before calling snd_rawmidi_receive().\n2. Unsubscribe enters close_substream(), clears input_triggered through\n   the provider trigger callback and returns from cancel_work_sync().\n   The substream is still opened.\n3. The completion resumes. snd_rawmidi_receive() takes substream->lock,\n   sees opened set and queues runtime->event_work before dropping the\n   lock.\n4. Close clears opened under that lock, closes the provider and frees\n   the runtime. Stopping USB URBs does not drain the raw-MIDI work.\n5. The queued work runs and snd_rawmidi_input_event_work() reads event\n   or substream from the freed runtime, causing a use-after-free.\n\nCancel input event_work again after clearing opened, before closing the\nprovider or releasing the runtime's private data. Receive holds\nsubstream->lock through its opened check and work enqueue, so once close\nhas cleared opened under that lock, no further receive can queue work.\nThe final cancellation therefore drains any late work before the\nruntime is freed. Keep it outside the spinlock so a running callback can\nfinish.","Type":"Description","Title":"ALSA: rawmidi: Drain input work before freeing the runtime"}]}}}