Skip to content

Commit

Permalink
ALSA: seq: Drop UMP events when no UMP-conversion is set
Browse files Browse the repository at this point in the history
When a destination client is a user client in the legacy MIDI mode and
it sets the no-UMP-conversion flag, currently the all UMP events are
still passed as-is.  But this may confuse the user-space, because the
event packet size is different from the legacy mode.

Since we cannot handle UMP events in user clients unless it's running
in the UMP client mode, we should filter out those events instead of
accepting blindly.  This patch addresses it by slightly adjusting the
conditions for UMP event handling at the event delivery time.

Fixes: 329ffe1 ("ALSA: seq: Allow suppressing UMP conversions")
Link: https://lore.kernel.org/[email protected]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Feb 17, 2025
1 parent 6d1f866 commit e77aa4b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sound/core/seq/seq_clientmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,18 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client,
dest_port->time_real);

#if IS_ENABLED(CONFIG_SND_SEQ_UMP)
if (!(dest->filter & SNDRV_SEQ_FILTER_NO_CONVERT)) {
if (snd_seq_ev_is_ump(event)) {
if (snd_seq_ev_is_ump(event)) {
if (!(dest->filter & SNDRV_SEQ_FILTER_NO_CONVERT)) {
result = snd_seq_deliver_from_ump(client, dest, dest_port,
event, atomic, hop);
goto __skip;
} else if (snd_seq_client_is_ump(dest)) {
} else if (dest->type == USER_CLIENT &&
!snd_seq_client_is_ump(dest)) {
result = 0; // drop the event
goto __skip;
}
} else if (snd_seq_client_is_ump(dest)) {
if (!(dest->filter & SNDRV_SEQ_FILTER_NO_CONVERT)) {
result = snd_seq_deliver_to_ump(client, dest, dest_port,
event, atomic, hop);
goto __skip;
Expand Down

0 comments on commit e77aa4b

Please sign in to comment.