Skip to content

Commit 1b9a073

Browse files
committed
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 <perex@perex.cz>
1 parent 6855cb8 commit 1b9a073

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/seq/seq_hw.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ static int snd_seq_hw_set_client_info(snd_seq_t *seq, snd_seq_client_info_t * in
125125
{
126126
snd_seq_hw_t *hw = seq->private_data;
127127

128+
/* added fields are not checked on older kernels */
129+
if (SNDRV_PROTOCOL_VERSION(1, 0, 3) > hw->version) {
130+
if (info->midi_version > 0)
131+
return -EINVAL;
132+
if (info->filter & SNDRV_SEQ_FILTER_NO_CONVERT)
133+
return -EINVAL;
134+
if (info->group_filter != 0)
135+
return -EINVAL;
136+
}
128137
if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info) < 0) {
129138
/*SYSERR("SNDRV_SEQ_IOCTL_SET_CLIENT_INFO failed");*/
130139
return -errno;

0 commit comments

Comments
 (0)