Skip to content

Commit 8765429

Browse files
committed
ALSA: seq: Check UMP support for midi_version change
When the kernel is built without UMP support but a user-space app requires the midi_version > 0, the kernel should return an error. Otherwise user-space assumes as if it were possible to deal, eventually hitting serious errors later. Fixes: 4639762 ("ALSA: seq: Add UMP support") Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/20241231145358.21946-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 7b50991 commit 8765429

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sound/core/seq/seq_clientmgr.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,10 +1275,16 @@ static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
12751275
if (client->type != client_info->type)
12761276
return -EINVAL;
12771277

1278-
/* check validity of midi_version field */
1279-
if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3) &&
1280-
client_info->midi_version > SNDRV_SEQ_CLIENT_UMP_MIDI_2_0)
1281-
return -EINVAL;
1278+
if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3)) {
1279+
/* check validity of midi_version field */
1280+
if (client_info->midi_version > SNDRV_SEQ_CLIENT_UMP_MIDI_2_0)
1281+
return -EINVAL;
1282+
1283+
/* check if UMP is supported in kernel */
1284+
if (!IS_ENABLED(CONFIG_SND_SEQ_UMP) &&
1285+
client_info->midi_version > 0)
1286+
return -EINVAL;
1287+
}
12821288

12831289
/* fill the info fields */
12841290
if (client_info->name[0])

0 commit comments

Comments
 (0)