Skip to contentSkip to conversation

ALSA: compress: add support for 32bit calls in a 64bit kernel

PATCH Superseded Ravindra Lokhande 2 participants 2 messages Dec 4, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ALSA: compress: add support for 32bit calls in a 64bit kernel

Compress offload does not support ioctl calls from a 32bit userspace in a 64 bit kernel. This patch adds support for ioctls from a 32bit userspace in a 64bit kernel

---

v1 -> v2: use compat_ptr to convert 32 bit address to 64 bit pointer

 sound/core/compress_offload.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
sound/core/compress_offload.c +12 -0
index b123c42..4c156a7 100644
@@ -847,6 +847,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 	return retval;
 }
 
+/* support of 32bit userspace on 64bit platforms */
+#ifdef CONFIG_COMPAT
+static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd,
+						unsigned long arg)
+{
+	return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
 static const struct file_operations snd_compr_file_ops = {
 		.owner =	THIS_MODULE,
 		.open =		snd_compr_open,
@@ -854,6 +863,9 @@ static const struct file_operations snd_compr_file_ops = {
 		.write =	snd_compr_write,
 		.read =		snd_compr_read,
 		.unlocked_ioctl = snd_compr_ioctl,
+#ifdef CONFIG_COMPAT
+		.compat_ioctl = snd_compr_ioctl_compat,
+#endif
 		.mmap =		snd_compr_mmap,
 		.poll =		snd_compr_poll,
 };
Signature · 1 line
2.1.4
#1 lore raw
Quoted 18 lines · Ravindra Lokhande

Compress offload does not support ioctl calls from a 32bit userspace in a 64 bit kernel. This patch adds support for ioctls from a 32bit userspace in a 64bit kernel

---

v1 -> v2: use compat_ptr to convert 32 bit address to 64 bit pointer

 sound/core/compress_offload.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
sound/core/compress_offload.c +0 -0
index b123c42..4c156a7 100644

sound/core/compress_offload.c static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) · line 855

Quoted 9 lines
sound/core/compress_offload.c +6 -0
@@ -847,6 +847,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 	return retval;
 }
 
+/* support of 32bit userspace on 64bit platforms */
+#ifdef CONFIG_COMPAT
+static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd,
+						unsigned long arg)
+{
+	return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg));

You need to include <linux/compat.h> for this macro.

Takashi

Quoted 24 lines
sound/core/compress_offload.c +6 -0
+}
+#endif
+
 static const struct file_operations snd_compr_file_ops = {
 		.owner =	THIS_MODULE,
 		.open =		snd_compr_open,
@@ -854,6 +863,9 @@ static const struct file_operations snd_compr_file_ops = {
 		.write =	snd_compr_write,
 		.read =		snd_compr_read,
 		.unlocked_ioctl = snd_compr_ioctl,
+#ifdef CONFIG_COMPAT
+		.compat_ioctl = snd_compr_ioctl_compat,
+#endif
 		.mmap =		snd_compr_mmap,
 		.poll =		snd_compr_poll,
 };
Signature · 6 lines
2.1.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel