From: Jaroslav Kysela Date: Thu, 20 Mar 2025 20:55:23 +0000 (+0100) Subject: seq: add more checks to snd_seq_hw_set_client_info for older kernels X-Git-Tag: v1.2.14~19 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=1b9a073e6a4e56a0faf75188966968621abd0786;p=alsa-lib.git seq: add more checks to snd_seq_hw_set_client_info for older kernels 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 --- diff --git a/src/seq/seq_hw.c b/src/seq/seq_hw.c index e88a7b22..5e9b8953 100644 --- a/src/seq/seq_hw.c +++ b/src/seq/seq_hw.c @@ -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;