|
@@ -1003,7 +1003,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
|
|
{
|
|
{
|
|
struct snd_seq_client *client = file->private_data;
|
|
struct snd_seq_client *client = file->private_data;
|
|
int written = 0, len;
|
|
int written = 0, len;
|
|
- int err = -EINVAL;
|
|
|
|
|
|
+ int err;
|
|
struct snd_seq_event event;
|
|
struct snd_seq_event event;
|
|
|
|
|
|
if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
|
|
if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
|
|
@@ -1018,11 +1018,15 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
|
|
|
|
|
|
/* allocate the pool now if the pool is not allocated yet */
|
|
/* allocate the pool now if the pool is not allocated yet */
|
|
if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) {
|
|
if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) {
|
|
- if (snd_seq_pool_init(client->pool) < 0)
|
|
|
|
|
|
+ mutex_lock(&client->ioctl_mutex);
|
|
|
|
+ err = snd_seq_pool_init(client->pool);
|
|
|
|
+ mutex_unlock(&client->ioctl_mutex);
|
|
|
|
+ if (err < 0)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
|
|
|
|
/* only process whole events */
|
|
/* only process whole events */
|
|
|
|
+ err = -EINVAL;
|
|
while (count >= sizeof(struct snd_seq_event)) {
|
|
while (count >= sizeof(struct snd_seq_event)) {
|
|
/* Read in the event header from the user */
|
|
/* Read in the event header from the user */
|
|
len = sizeof(event);
|
|
len = sizeof(event);
|