aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-4.19/950-0314-char-vcio-Add-compat-ioctl-handling.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2019-07-31 18:23:26 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2019-08-02 18:51:32 +0200
commit19226502bf6393706defe7f049c587b32c9b4f33 (patch)
tree0bff89a72b7006051a6eec1ac3c0c9250490cf4f /target/linux/brcm2708/patches-4.19/950-0314-char-vcio-Add-compat-ioctl-handling.patch
parent66458c49aa14ebc9ba2e4f9b6a323b8ff122807b (diff)
downloadupstream-19226502bf6393706defe7f049c587b32c9b4f33.tar.gz
upstream-19226502bf6393706defe7f049c587b32c9b4f33.tar.bz2
upstream-19226502bf6393706defe7f049c587b32c9b4f33.zip
brcm2708: update to latest patches from the RPi foundation
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.19/950-0314-char-vcio-Add-compat-ioctl-handling.patch')
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0314-char-vcio-Add-compat-ioctl-handling.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.19/950-0314-char-vcio-Add-compat-ioctl-handling.patch b/target/linux/brcm2708/patches-4.19/950-0314-char-vcio-Add-compat-ioctl-handling.patch
new file mode 100644
index 0000000000..cd4bd43faf
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.19/950-0314-char-vcio-Add-compat-ioctl-handling.patch
@@ -0,0 +1,58 @@
+From cc33f2492b4b2c0d377f99c19a46207297004631 Mon Sep 17 00:00:00 2001
+From: Dave Stevenson <dave.stevenson@raspberrypi.org>
+Date: Thu, 24 Jan 2019 13:56:30 +0000
+Subject: [PATCH 314/725] char: vcio: Add compat ioctl handling
+
+There was no compat ioctl handler, so 32 bit userspace on a
+64 bit kernel failed as IOCTL_MBOX_PROPERTY used the size
+of char*.
+
+Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+---
+ drivers/char/broadcom/vcio.c | 22 +++++++++++++++++++++-
+ 1 file changed, 21 insertions(+), 1 deletion(-)
+
+--- a/drivers/char/broadcom/vcio.c
++++ b/drivers/char/broadcom/vcio.c
+@@ -24,6 +24,9 @@
+
+ #define VCIO_IOC_MAGIC 100
+ #define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *)
++#ifdef CONFIG_COMPAT
++#define IOCTL_MBOX_PROPERTY32 _IOWR(VCIO_IOC_MAGIC, 0, compat_uptr_t)
++#endif
+
+ static struct {
+ dev_t devt;
+@@ -87,13 +90,30 @@ static long vcio_device_ioctl(struct fil
+ case IOCTL_MBOX_PROPERTY:
+ return vcio_user_property_list((void *)ioctl_param);
+ default:
+- pr_err("unknown ioctl: %d\n", ioctl_num);
++ pr_err("unknown ioctl: %x\n", ioctl_num);
+ return -EINVAL;
+ }
+ }
+
++#ifdef CONFIG_COMPAT
++static long vcio_device_compat_ioctl(struct file *file, unsigned int ioctl_num,
++ unsigned long ioctl_param)
++{
++ switch (ioctl_num) {
++ case IOCTL_MBOX_PROPERTY32:
++ return vcio_user_property_list(compat_ptr(ioctl_param));
++ default:
++ pr_err("unknown ioctl: %x\n", ioctl_num);
++ return -EINVAL;
++ }
++}
++#endif
++
+ const struct file_operations vcio_fops = {
+ .unlocked_ioctl = vcio_device_ioctl,
++#ifdef CONFIG_COMPAT
++ .compat_ioctl = vcio_device_compat_ioctl,
++#endif
+ .open = vcio_device_open,
+ .release = vcio_device_release,
+ };