{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2026-74387",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2026-08-15T05:44:03.890Z",
        "datePublished": "2026-08-15T05:59:02.457Z",
        "dateUpdated": "2026-08-17T05:46:36.550Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-17T05:46:36.550Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nALSA: seq: midi: Serialize output teardown with event_input\n\nevent_process_midi() borrows msynth->output_rfile.output and then\npasses the substream to dump_midi() and snd_rawmidi_kernel_write()\nwithout synchronizing with the output open/close transition.\nmidisynth_use() also publishes output_rfile before\nsnd_rawmidi_output_params() has finished.\n\nThe last midisynth_unuse() can therefore release the same rawmidi file\nand free substream->runtime before snd_rawmidi_kernel_write1() takes\nits runtime buffer reference. That leaves the event_input path using a\nstale substream or runtime and can end in a NULL-deref or use-after-free.\n\nFix this with two pieces of synchronization. Keep a short IRQ-safe\nspinlock only for publishing or clearing output_rfile and for pairing\nthe output snapshot with an snd_use_lock_t reference. Once\nevent_process_midi() has taken that in-flight reference, it drops the\nspinlock before calling snd_seq_dump_var_event(), dump_midi(), or\nsnd_rawmidi_kernel_write(). midisynth_unuse() now detaches the visible\nrawmidi file under the same spinlock, waits for the in-flight writers\nto drain, and only then drains and releases the saved file.\nmidisynth_use() likewise opens into a local snd_rawmidi_file and\npublishes it only after snd_rawmidi_output_params() succeeds.\n\nThe buggy scenario involves two paths, with each column showing the\norder within that path:\n\nevent_input path:                     last unuse path:\n1. event_process_midi() snapshots    1. midisynth_unuse() starts\n   output_rfile.output.                 tearing down output_rfile.\n2. dump_midi() reaches               2. snd_rawmidi_kernel_release()\n   snd_rawmidi_kernel_write()           closes the output file.\n   before runtime is pinned.         3. close_substream() frees\n3. The callback keeps using             substream->runtime.\n   the borrowed substream.\n\nValidation reproduced this kernel report:\nKASAN null-ptr-deref in snd_rawmidi_kernel_write1+0x56/0x360\nRIP: 0033:0x7fde7dd0837f\nRIP: 0010:snd_rawmidi_kernel_write1+0x56/0x360"
                }
            ],
            "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 bug is reached only via local ALSA sequencer interfaces: opening /dev/snd/seq, subscribing to a MIDI synth port (SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT), writing events (snd_seq_write), and unsubscribing (SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT). There is no network, Bluetooth, or physical-device packet path to event_process_midi().\nAC:L - Exploitation is a race between MIDI event delivery and the last midisynth_unuse() teardown; an attacker controls both sides by concurrently writing sequencer events and unsubscribing from the same MIDI output port. Published reproducers triggered KASAN null-deref/UAF reliably without external timing luck.\nPR:L - Any unprivileged local user with standard ALSA access (typically membership in the audio group for /dev/snd/seq) can create a sequencer client, subscribe to hardware MIDI synth ports, dispatch events, and trigger teardown. No real root/CAP_SYS_ADMIN or user-namespace capability is required.\nUI:N - Exploitation requires no victim interaction; the attacker programmatically opens the sequencer, subscribes, floods MIDI events, and unsubscribes from their own client. No mount, file open, or other user-driven action by another party is needed.\nS:U - Impact is kernel memory corruption and potential local privilege escalation within the same kernel security domain. It does not cross a VM/host, IOMMU, or sandbox boundary; compromised resources remain under the same OS authority.\nC:H - The race frees substream->runtime (kmalloc-192 snd_rawmidi_runtime) while event_process_midi() still dereferences it in dump_midi()/snd_rawmidi_kernel_write1(), producing a confirmed slab use-after-free and NULL-deref. UAF on kernel heap objects enables arbitrary memory disclosure via heap grooming.\nI:H - Use-after-free of the rawmidi runtime while the write path accesses runtime->buffer and related fields can be turned into controlled heap corruption and arbitrary kernel writes/code execution, not merely a one-shot crash. Memory corruption primitives warrant High integrity impact.\nA:H - Concurrent unsubscribe frees the output runtime during an in-flight write, causing KASAN-reported null-pointer dereference and slab use-after-free in snd_rawmidi_kernel_write1(). This can oops or panic the kernel and be retriggered by repeated subscribe/write/unsubscribe cycles."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "sound/core/seq/seq_midi.c"
                    ],
                    "versions": [
                        {
                            "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
                            "lessThan": "f5d470b808bc01f70978e22e595c6f7768313406",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
                            "lessThan": "936641af564c3d92721704b781e36aaf223efdd2",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
                            "lessThan": "718f6a56b40875f19e6915799044a02df9abfd52",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
                            "lessThan": "11165fe2c5ea0516debe486d91df67abbe36905e",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
                            "lessThan": "d6fd2afb137f52bf00c5210cc44d08ed54dcffb4",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
                            "lessThan": "ef7607ab1c8adc6258fb1b27d08e26aecdc18a58",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "sound/core/seq/seq_midi.c"
                    ],
                    "versions": [
                        {
                            "version": "2.6.12",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "2.6.12",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.1.178",
                            "lessThanOrEqual": "6.1.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.6.145",
                            "lessThanOrEqual": "6.6.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.97",
                            "lessThanOrEqual": "6.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.18.40",
                            "lessThanOrEqual": "6.18.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "7.1.5",
                            "lessThanOrEqual": "7.1.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "7.2",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.12",
                                    "versionEndExcluding": "6.1.178"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.12",
                                    "versionEndExcluding": "6.6.145"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.12",
                                    "versionEndExcluding": "6.12.97"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.12",
                                    "versionEndExcluding": "6.18.40"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.12",
                                    "versionEndExcluding": "7.1.5"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.12",
                                    "versionEndExcluding": "7.2"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/f5d470b808bc01f70978e22e595c6f7768313406"
                },
                {
                    "url": "https://git.kernel.org/stable/c/936641af564c3d92721704b781e36aaf223efdd2"
                },
                {
                    "url": "https://git.kernel.org/stable/c/718f6a56b40875f19e6915799044a02df9abfd52"
                },
                {
                    "url": "https://git.kernel.org/stable/c/11165fe2c5ea0516debe486d91df67abbe36905e"
                },
                {
                    "url": "https://git.kernel.org/stable/c/d6fd2afb137f52bf00c5210cc44d08ed54dcffb4"
                },
                {
                    "url": "https://git.kernel.org/stable/c/ef7607ab1c8adc6258fb1b27d08e26aecdc18a58"
                }
            ],
            "title": "ALSA: seq: midi: Serialize output teardown with event_input",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}