]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/input-uinput-add-compat-ioctl-number-translation-for-ui_-_ff_upload.patch
4.19-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / input-uinput-add-compat-ioctl-number-translation-for-ui_-_ff_upload.patch
1 From 7c7da40da1640ce6814dab1e8031b44e19e5a3f6 Mon Sep 17 00:00:00 2001
2 From: Andrey Smirnov <andrew.smirnov@gmail.com>
3 Date: Thu, 23 May 2019 12:55:26 -0700
4 Subject: Input: uinput - add compat ioctl number translation for UI_*_FF_UPLOAD
5
6 From: Andrey Smirnov <andrew.smirnov@gmail.com>
7
8 commit 7c7da40da1640ce6814dab1e8031b44e19e5a3f6 upstream.
9
10 In the case of compat syscall ioctl numbers for UI_BEGIN_FF_UPLOAD and
11 UI_END_FF_UPLOAD need to be adjusted before being passed on
12 uinput_ioctl_handler() since code built with -m32 will be passing
13 slightly different values. Extend the code already covering
14 UI_SET_PHYS to cover UI_BEGIN_FF_UPLOAD and UI_END_FF_UPLOAD as well.
15
16 Reported-by: Pierre-Loup A. Griffais <pgriffais@valvesoftware.com>
17 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
18 Cc: stable@vger.kernel.org
19 Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 drivers/input/misc/uinput.c | 22 ++++++++++++++++++++--
24 1 file changed, 20 insertions(+), 2 deletions(-)
25
26 --- a/drivers/input/misc/uinput.c
27 +++ b/drivers/input/misc/uinput.c
28 @@ -1051,13 +1051,31 @@ static long uinput_ioctl(struct file *fi
29
30 #ifdef CONFIG_COMPAT
31
32 -#define UI_SET_PHYS_COMPAT _IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t)
33 +/*
34 + * These IOCTLs change their size and thus their numbers between
35 + * 32 and 64 bits.
36 + */
37 +#define UI_SET_PHYS_COMPAT \
38 + _IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t)
39 +#define UI_BEGIN_FF_UPLOAD_COMPAT \
40 + _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload_compat)
41 +#define UI_END_FF_UPLOAD_COMPAT \
42 + _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload_compat)
43
44 static long uinput_compat_ioctl(struct file *file,
45 unsigned int cmd, unsigned long arg)
46 {
47 - if (cmd == UI_SET_PHYS_COMPAT)
48 + switch (cmd) {
49 + case UI_SET_PHYS_COMPAT:
50 cmd = UI_SET_PHYS;
51 + break;
52 + case UI_BEGIN_FF_UPLOAD_COMPAT:
53 + cmd = UI_BEGIN_FF_UPLOAD;
54 + break;
55 + case UI_END_FF_UPLOAD_COMPAT:
56 + cmd = UI_END_FF_UPLOAD;
57 + break;
58 + }
59
60 return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg));
61 }