Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Baul Lee <baul.lee@xbow.com>
Cc: linux-sound@vger.kernel.org, perex@perex.cz, tiwai@suse.com,
	federico.kirschbaum@xbow.com, stable@vger.kernel.org
Subject: Re: [PATCH] ALSA: ump: fix double free of out_cvts on rawmidi error
Date: Sun, 26 Jul 2026 08:59:43 +0200	[thread overview]
Message-ID: <87bjbub5i8.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260726051633.41206-1-baul.lee@xbow.com>

On Sun, 26 Jul 2026 07:16:33 +0200,
Baul Lee wrote:
> 
> snd_ump_attach_legacy_rawmidi() allocates the legacy conversion array
> ump->out_cvts and, on the snd_rawmidi_new() error path, frees it with
> kfree() but leaves ump->out_cvts pointing at the freed memory.  When the
> endpoint is later torn down, snd_ump_endpoint_free() frees ump->out_cvts
> a second time, resulting in a double free.
> 
> The host snd-usb-audio driver attaches the legacy rawmidi for any USB
> MIDI 2.0 (UMP) device, so a device that makes snd_rawmidi_new() fail
> reaches this path on enumeration.
> 
> Clear ump->out_cvts after freeing it on the error path so it is not
> freed again during teardown.
> 
> Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>
> 
> Fixes: 33cd7630782d ("ALSA: ump: Export MIDI1 / UMP conversion helpers")
> Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
> Reported-by: Baul Lee <baul.lee@xbow.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Baul Lee <baul.lee@xbow.com>

Applied now.  Thanks.


Takashi

      reply	other threads:[~2026-07-26  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-26  5:16 [PATCH] ALSA: ump: fix double free of out_cvts on rawmidi error Baul Lee
2026-07-26  6:59 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bjbub5i8.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=baul.lee@xbow.com \
    --cc=federico.kirschbaum@xbow.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox