In the Linux kernel, the following vulnerability has been resolved:
ALSA: usb-audio: Fix potential memory leaks at error path for UMP open
The allocation and initialization errors at allocmidiurbs() that is called at MIDI 2.0 / UMP device are supposed to be handled at the caller side by invoking freemidiurbs(). However, freemidiurbs() loops only for ep->numurbs entries, and since ep->numentries wasn't updated yet at the allocation / init error in allocmidiurbs(), this entry won't be released.
The intention of freemidiurbs() is to release the whole elements, so change the loop size to NUM_URBS to scan over all elements for fixing the missed releases.
Also, the call of freemidiurbs() is missing at sndusbmidiv2open(). Although it'll be released later at reopen/close or disconnection, it's better to release immediately at the error path.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/54xxx/CVE-2023-54022.json"
}