stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.15.y] ALSA: seq: Fix port lock leak in deliver_to_subscribers()
@ 2026-09-04  7:04 Tzung-Bi Shih
  2026-09-06 13:32 ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-09-04  7:04 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Sasha Levin, Greg Kroah-Hartman
  Cc: tzungbi, alsa-devel, stable

Commit 46397622a3fa ("ALSA: seq: Add UMP support") mistakenly removed
the `snd_seq_port_unlock(src_port)` call in deliver_to_subscribers().
As a result, every time an event is delivered to a subscriber, the
source port's `use_lock` atomic counter is increased but never
decreased.

The leak prevents ALSA sequencer ports from closing cleanly.  When the
client process exits or destroys the port, port_delete() hangs forever
at snd_use_lock_sync().  The process becomes stuck in an unkillable D
state, triggering the following warning:

    ALSA: seq_lock: waiting [1 left] in sound/core/seq/seq_ports.c:250

Restore the missing `snd_seq_port_unlock(src_port)`.

Note that commit 177ccf811df4 ("ALSA: seq: Support MIDI 2.0 UMP Endpoint
port") incidentally resolved this issue upstream when it refactored the
locking logic into a wrapper function.  However, since the commit
introduces a new feature and might not be suitable for stable release
branches, this targeted fix is necessary.

Fixes: 6389f2c13531 ("ALSA: seq: Add UMP support")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 sound/core/seq/seq_clientmgr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index f2feeb97765c..bd2d7a9fab5b 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -733,6 +733,7 @@ static int deliver_to_subscribers(struct snd_seq_client *client,
 		read_unlock(&grp->list_lock);
 	else
 		up_read(&grp->list_mutex);
+	snd_seq_port_unlock(src_port);
 	memcpy(event, &event_saved, saved_size);
 	return (result < 0) ? result : num_ev;
 }
-- 
2.55.0.979.g7e5102b832-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.15.y] ALSA: seq: Fix port lock leak in deliver_to_subscribers()
  2026-09-04  7:04 [PATCH 5.15.y] ALSA: seq: Fix port lock leak in deliver_to_subscribers() Tzung-Bi Shih
@ 2026-09-06 13:32 ` Sasha Levin
  2026-09-07 19:29   ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2026-09-06 13:32 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman
  Cc: Sasha Levin, tzungbi, alsa-devel, stable

> Commit 46397622a3fa ("ALSA: seq: Add UMP support") mistakenly removed
> the `snd_seq_port_unlock(src_port)` call in deliver_to_subscribers().
> As a result, every time an event is delivered to a subscriber, the
> source port's `use_lock` atomic counter is increased but never

The fix itself looks right - restores exactly the unlock that
46397622a3fa dropped, nothing else touched. But there's no mainline
commit backing it (the actual upstream fix would be 177ccf811df4, which
is a MIDI 2.0 feature commit and not stable material on its own), so
this is a stable-only fix and needs a subsystem Ack before it can go in.

Jaroslav, Takashi - can either of you Ack this for 5.15.y?

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.15.y] ALSA: seq: Fix port lock leak in deliver_to_subscribers()
  2026-09-06 13:32 ` Sasha Levin
@ 2026-09-07 19:29   ` Takashi Iwai
  2026-09-08  0:53     ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2026-09-07 19:29 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman, tzungbi,
	alsa-devel, stable

On Sun, 06 Sep 2026 15:32:59 +0200,
Sasha Levin wrote:
> 
> > Commit 46397622a3fa ("ALSA: seq: Add UMP support") mistakenly removed
> > the `snd_seq_port_unlock(src_port)` call in deliver_to_subscribers().
> > As a result, every time an event is delivered to a subscriber, the
> > source port's `use_lock` atomic counter is increased but never
> 
> The fix itself looks right - restores exactly the unlock that
> 46397622a3fa dropped, nothing else touched. But there's no mainline
> commit backing it (the actual upstream fix would be 177ccf811df4, which
> is a MIDI 2.0 feature commit and not stable material on its own), so
> this is a stable-only fix and needs a subsystem Ack before it can go in.
> 
> Jaroslav, Takashi - can either of you Ack this for 5.15.y?

Reviewed-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.15.y] ALSA: seq: Fix port lock leak in deliver_to_subscribers()
  2026-09-07 19:29   ` Takashi Iwai
@ 2026-09-08  0:53     ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2026-09-08  0:53 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Sasha Levin, Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman,
	tzungbi, alsa-devel, stable

> Reviewed-by: Takashi Iwai <tiwai@suse.de>

Thanks for the ack. Queued for 5.15.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-08  0:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04  7:04 [PATCH 5.15.y] ALSA: seq: Fix port lock leak in deliver_to_subscribers() Tzung-Bi Shih
2026-09-06 13:32 ` Sasha Levin
2026-09-07 19:29   ` Takashi Iwai
2026-09-08  0:53     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).