public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jeongjun Park <aha310510@gmail.com>
Cc: stable@vger.kernel.org, Takashi Iwai <tiwai@suse.de>,
	syzbot+d8f72178ab6783a7daea@syzkaller.appspotmail.com,
	Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>,
	alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6.12.y 6.6.y 6.1.y 5.15.y 5.10.y 5.4.y] ALSA: usb-audio: Kill timer properly at removal
Date: Wed, 8 Oct 2025 07:54:02 +0200	[thread overview]
Message-ID: <2025100824-frolic-spout-d400@gregkh> (raw)
In-Reply-To: <20251007155808.438441-1-aha310510@gmail.com>

On Wed, Oct 08, 2025 at 12:58:08AM +0900, Jeongjun Park wrote:
> From: Takashi Iwai <tiwai@suse.de>
> 
> [ Upstream commit 0718a78f6a9f04b88d0dc9616cc216b31c5f3cf1 ]
> 
> The USB-audio MIDI code initializes the timer, but in a rare case, the
> driver might be freed without the disconnect call.  This leaves the
> timer in an active state while the assigned object is released via
> snd_usbmidi_free(), which ends up with a kernel warning when the debug
> configuration is enabled, as spotted by fuzzer.
> 
> For avoiding the problem, put timer_shutdown_sync() at
> snd_usbmidi_free(), so that the timer can be killed properly.
> While we're at it, replace the existing timer_delete_sync() at the
> disconnect callback with timer_shutdown_sync(), too.
> 
> Reported-by: syzbot+d8f72178ab6783a7daea@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/681c70d7.050a0220.a19a9.00c6.GAE@google.com
> Cc: <stable@vger.kernel.org>
> Link: https://patch.msgid.link/20250519212031.14436-1-tiwai@suse.de
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> [ del_timer vs timer_delete differences ]
> Signed-off-by: Jeongjun Park <aha310510@gmail.com>
> ---
>  sound/usb/midi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/usb/midi.c b/sound/usb/midi.c
> index a792ada18863..c3de2b137435 100644
> --- a/sound/usb/midi.c
> +++ b/sound/usb/midi.c
> @@ -1530,6 +1530,7 @@ static void snd_usbmidi_free(struct snd_usb_midi *umidi)
>  			snd_usbmidi_in_endpoint_delete(ep->in);
>  	}
>  	mutex_destroy(&umidi->mutex);
> +	timer_shutdown_sync(&umidi->error_timer);

This function is not in older kernel versions, you did not test this
build :(

I've applied this to 6.6.y and newer, but for 6.1.y and older, please
use the proper function.

thanks,

greg k-h

  reply	other threads:[~2025-10-08  5:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07 15:58 [PATCH 6.12.y 6.6.y 6.1.y 5.15.y 5.10.y 5.4.y] ALSA: usb-audio: Kill timer properly at removal Jeongjun Park
2025-10-08  5:54 ` Greg KH [this message]
2025-10-09 11:23   ` Jeongjun Park
2025-10-09 11:26     ` Greg KH
2025-10-09 12:42       ` Jeongjun Park

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=2025100824-frolic-spout-d400@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=aha310510@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+d8f72178ab6783a7daea@syzkaller.appspotmail.com \
    --cc=tiwai@suse.de \
    /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