aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/seq/oss/seq_oss_device.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-04-12 12:44:39 +0200
committerTakashi Iwai <tiwai@suse.de>2019-04-12 13:07:25 +0200
commit6b580f523172f2c738b661069a57c23c74a75f88 (patch)
treed772938f0958be15c9f097fecfdccc39609c9b7b /sound/core/seq/oss/seq_oss_device.h
parentALSA: seq: Simplify snd_seq_kernel_client_enqueue() helper (diff)
downloadlinux-dev-6b580f523172f2c738b661069a57c23c74a75f88.tar.xz
linux-dev-6b580f523172f2c738b661069a57c23c74a75f88.zip
ALSA: seq: Protect racy pool manipulation from OSS sequencer
OSS sequencer emulation still allows to queue and issue the events that manipulate the client pool concurrently in a racy way. This patch serializes the access like the normal sequencer write / ioctl via taking the client ioctl_mutex. Since the access to the sequencer client is done indirectly via a client id number, a new helper to take/release the mutex is introduced. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/oss/seq_oss_device.h')
-rw-r--r--sound/core/seq/oss/seq_oss_device.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h
index 2d0e9eaf13aa..77eb1fe1155c 100644
--- a/sound/core/seq/oss/seq_oss_device.h
+++ b/sound/core/seq/oss/seq_oss_device.h
@@ -30,6 +30,7 @@
#include <sound/rawmidi.h>
#include <sound/seq_kernel.h>
#include <sound/info.h>
+#include "../seq_clientmgr.h"
/* max. applications */
#define SNDRV_SEQ_OSS_MAX_CLIENTS 16
@@ -150,11 +151,16 @@ snd_seq_oss_dispatch(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, int a
return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop);
}
-/* ioctl */
+/* ioctl for writeq */
static inline int
snd_seq_oss_control(struct seq_oss_devinfo *dp, unsigned int type, void *arg)
{
- return snd_seq_kernel_client_ctl(dp->cseq, type, arg);
+ int err;
+
+ snd_seq_client_ioctl_lock(dp->cseq);
+ err = snd_seq_kernel_client_ctl(dp->cseq, type, arg);
+ snd_seq_client_ioctl_unlock(dp->cseq);
+ return err;
}
/* fill the addresses in header */