[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250927091931.7691-1-hdanton@sina.com>
Date: Sat, 27 Sep 2025 17:19:29 +0800
From: Hillf Danton <hdanton@...a.com>
To: syzbot <syzbot+f02665daa2abeef4a947@...kaller.appspotmail.com>
Cc: Takashi Iwai <tiwai@...e.de>,
Jeongjun Park <aha310510@...il.com>,
clemens@...isch.de,
perex@...ex.cz,
syzkaller-bugs@...glegroups.com,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ALSA: usb-audio: fix race condition to UAF in snd_usbmidi_free
On Sat, 27 Sep 2025 10:01:37 +0200 Takashi Iwai wrote:
>On Sat, 27 Sep 2025 06:41:06 +0200 Jeongjun Park wrote:
>>
>> The previous commit 0718a78f6a9f ("ALSA: usb-audio: Kill timer properly at
>> removal") patched a UAF issue caused by the error timer.
>>
>> However, because the error timer kill added in this patch occurs after the
>> endpoint delete, a race condition to UAF still occurs, albeit rarely.
>>
>> Therefore, to prevent this, the error timer must be killed before freeing
>> the heap memory.
>>
>> Cc: <stable@...r.kernel.org>
>> Fixes: 0718a78f6a9f ("ALSA: usb-audio: Kill timer properly at removal")
>> Signed-off-by: Jeongjun Park <aha310510@...il.com>
>
> I suppose it's a fix for the recent syzbot reports?
> https://lore.kernel.org/68d17f44.050a0220.13cd81.05b7.GAE@google.com
> https://lore.kernel.org/68d38327.a70a0220.1b52b.02be.GAE@google.com
#syz test upstream master
--- x/sound/usb/midi.c
+++ y/sound/usb/midi.c
@@ -1522,6 +1522,8 @@ static void snd_usbmidi_free(struct snd_
{
int i;
+ timer_shutdown_sync(&umidi->error_timer);
+
for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i];
if (ep->out)
@@ -1530,7 +1532,6 @@ static void snd_usbmidi_free(struct snd_
snd_usbmidi_in_endpoint_delete(ep->in);
}
mutex_destroy(&umidi->mutex);
- timer_shutdown_sync(&umidi->error_timer);
kfree(umidi);
}
--
Powered by blists - more mailing lists