]> git.alsa-project.org Git - alsa-lib.git/commitdiff
seq: add more checks to snd_seq_hw_set_client_info for older kernels
authorJaroslav Kysela <perex@perex.cz>
Thu, 20 Mar 2025 20:55:23 +0000 (21:55 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 20 Mar 2025 20:55:54 +0000 (21:55 +0100)
The snd_seq_set_client_midi_version() should fail for older kernel
when applications are trying to configure new midi versions.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4621
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/seq/seq_hw.c

index e88a7b22b0528f1c81a47eff1c5b34ea6ce2b816..5e9b8953d15c34f20d336f1f8a5a474a973cd158 100644 (file)
@@ -125,6 +125,15 @@ static int snd_seq_hw_set_client_info(snd_seq_t *seq, snd_seq_client_info_t * in
 {
        snd_seq_hw_t *hw = seq->private_data;
 
+       /* added fields are not checked on older kernels */
+       if (SNDRV_PROTOCOL_VERSION(1, 0, 3) > hw->version) {
+               if (info->midi_version > 0)
+                       return -EINVAL;
+               if (info->filter & SNDRV_SEQ_FILTER_NO_CONVERT)
+                       return -EINVAL;
+               if (info->group_filter != 0)
+                       return -EINVAL;
+       }
        if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info) < 0) {
                /*SYSERR("SNDRV_SEQ_IOCTL_SET_CLIENT_INFO failed");*/
                return -errno;