diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-12-03 17:19:31 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-12-03 17:40:21 +0100 |
commit | 83266b6b60b6727af986e84a133dae24d394c3e8 (patch) | |
tree | 154f1a4d5da6347c89fb79ed055dcab1d9e6741f /sound/core/oss | |
parent | eb399d3c99d8b411bfc46e67ea329ddc1ca64e87 (diff) | |
download | linux-83266b6b60b6727af986e84a133dae24d394c3e8.tar.bz2 |
ALSA: Fix compat_ioctl handling for OSS emulations
The ALSA PCM, mixer and sequencer OSS emulations provide the 32bit
compatible ioctl, but they just call the 64bit native ioctl as is.
Although this works in most cases, passing the argument value as-is
isn't guaranteed to work on all architectures. We need to convert it
via compat_ptr() instead.
This patch addresses the missing conversions. Since all relevant
ioctls in these functions take the argument as a pointer, we do the
pointer conversion in each compat_ioctl and pass it as a 64bit value
to the native ioctl.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/oss')
-rw-r--r-- | sound/core/oss/mixer_oss.c | 8 | ||||
-rw-r--r-- | sound/core/oss/pcm_oss.c | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 7a8c79dd9734..2ff9c12d664a 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -24,6 +24,7 @@ #include <linux/time.h> #include <linux/string.h> #include <linux/module.h> +#include <linux/compat.h> #include <sound/core.h> #include <sound/minors.h> #include <sound/control.h> @@ -397,7 +398,12 @@ int snd_mixer_oss_ioctl_card(struct snd_card *card, unsigned int cmd, unsigned l #ifdef CONFIG_COMPAT /* all compatible */ -#define snd_mixer_oss_ioctl_compat snd_mixer_oss_ioctl +static long snd_mixer_oss_ioctl_compat(struct file *file, unsigned int cmd, + unsigned long arg) +{ + return snd_mixer_oss_ioctl1(file->private_data, cmd, + (unsigned long)compat_ptr(arg)); +} #else #define snd_mixer_oss_ioctl_compat NULL #endif diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 58550cc93f28..e557dbe469f4 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -33,6 +33,7 @@ #include <linux/module.h> #include <linux/math64.h> #include <linux/string.h> +#include <linux/compat.h> #include <sound/core.h> #include <sound/minors.h> #include <sound/pcm.h> @@ -2648,7 +2649,11 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long #ifdef CONFIG_COMPAT /* all compatible */ -#define snd_pcm_oss_ioctl_compat snd_pcm_oss_ioctl +static long snd_pcm_oss_ioctl_compat(struct file *file, unsigned int cmd, + unsigned long arg) +{ + return snd_pcm_oss_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} #else #define snd_pcm_oss_ioctl_compat NULL #endif |