mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 09:31:50 +00:00
ALSA: rawmidi: introduce SNDRV_RAWMIDI_IOCTL_USER_PVERSION
The new framing mode causes the user space regression, because
the alsa-lib code does not initialize the reserved space in
the params structure when the device is opened.
This change adds SNDRV_RAWMIDI_IOCTL_USER_PVERSION like we
do for the PCM interface for the protocol acknowledgment.
Cc: David Henningsson <coding@diwic.se>
Cc: <stable@vger.kernel.org>
Fixes: 08fdced60c
("ALSA: rawmidi: Add framing mode")
BugLink: https://github.com/alsa-project/alsa-lib/issues/178
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210920171850.154186-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
cb1bcf5ed5
commit
09d2317440
@ -98,6 +98,7 @@ struct snd_rawmidi_file {
|
||||
struct snd_rawmidi *rmidi;
|
||||
struct snd_rawmidi_substream *input;
|
||||
struct snd_rawmidi_substream *output;
|
||||
unsigned int user_pversion; /* supported protocol version */
|
||||
};
|
||||
|
||||
struct snd_rawmidi_str {
|
||||
|
@ -784,6 +784,7 @@ struct snd_rawmidi_status {
|
||||
|
||||
#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
|
||||
#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
|
||||
#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
|
||||
#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
|
||||
#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
|
||||
#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
|
||||
|
@ -873,12 +873,21 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
case SNDRV_RAWMIDI_IOCTL_USER_PVERSION:
|
||||
if (get_user(rfile->user_pversion, (unsigned int __user *)arg))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
|
||||
case SNDRV_RAWMIDI_IOCTL_PARAMS:
|
||||
{
|
||||
struct snd_rawmidi_params params;
|
||||
|
||||
if (copy_from_user(¶ms, argp, sizeof(struct snd_rawmidi_params)))
|
||||
return -EFAULT;
|
||||
if (rfile->user_pversion < SNDRV_PROTOCOL_VERSION(2, 0, 2)) {
|
||||
params.mode = 0;
|
||||
memset(params.reserved, 0, sizeof(params.reserved));
|
||||
}
|
||||
switch (params.stream) {
|
||||
case SNDRV_RAWMIDI_STREAM_OUTPUT:
|
||||
if (rfile->output == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user