The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Deepanshu Kartikey <kartikey406@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, kees@kernel.org,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+b6cab840e6a85641c7ad@syzkaller.appspotmail.com
Subject: Re: [PATCH] ALSA: ump: Fix double-free of ump->out_cvts on legacy rawmidi attach failure
Date: Wed, 29 Jul 2026 08:33:25 +0200	[thread overview]
Message-ID: <87mrva5mq2.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260729002333.11525-1-kartikey406@gmail.com>

On Wed, 29 Jul 2026 02:23:33 +0200,
Deepanshu Kartikey wrote:
> 
> If snd_rawmidi_new() fails inside snd_ump_attach_legacy_rawmidi(), the
> error path frees ump->out_cvts but leaves the pointer dangling. Since
> ump->out_cvts is a field of the long-lived struct snd_ump_endpoint
> (not the rawmidi device that failed to be created), it gets freed a
> second time later during normal endpoint teardown, in
> snd_ump_endpoint_free(), invoked via snd_rawmidi_free()'s
> private_free callback when the sound card is released. This results
> in a KASAN double-free/invalid-free.
> 
> Clear ump->out_cvts to NULL after freeing it on the error path, so
> the later unconditional kfree() in snd_ump_endpoint_free() becomes a
> harmless no-op.
> 
> Reported-by: syzbot+b6cab840e6a85641c7ad@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=b6cab840e6a85641c7ad
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>

The very same fix has been already merged in commit
70c977815af0d997feb2d0c5d284d55689bf7051 on sound git tree.


thanks,

Takashi

  reply	other threads:[~2026-07-29  6:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  0:23 [PATCH] ALSA: ump: Fix double-free of ump->out_cvts on legacy rawmidi attach failure Deepanshu Kartikey
2026-07-29  6:33 ` Takashi Iwai [this message]
     [not found] <20260729002134.11433-1-kartikey406@gmail.com>
2026-07-29  0:21 ` syzbot
     [not found] <20260729001845.11372-1-kartikey406@gmail.com>
2026-07-29  0:18 ` syzbot
     [not found] <20260729001642.11188-1-kartikey406@gmail.com>
2026-07-29  0:16 ` syzbot
     [not found] <20260729001509.11164-1-kartikey406@gmail.com>
2026-07-29  0:15 ` syzbot

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=87mrva5mq2.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=kartikey406@gmail.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=syzbot+b6cab840e6a85641c7ad@syzkaller.appspotmail.com \
    --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