<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/input/misc/uinput.c, branch v4.14.263</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2019-06-25T03:36:51+00:00</updated>
<entry>
<title>Input: uinput - add compat ioctl number translation for UI_*_FF_UPLOAD</title>
<updated>2019-06-25T03:36:51+00:00</updated>
<author>
<name>Andrey Smirnov</name>
<email>andrew.smirnov@gmail.com</email>
</author>
<published>2019-05-23T19:55:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fadee027bf8fa90f3057a98a89871cbe8dd4adf5'/>
<id>urn:sha1:fadee027bf8fa90f3057a98a89871cbe8dd4adf5</id>
<content type='text'>
commit 7c7da40da1640ce6814dab1e8031b44e19e5a3f6 upstream.

In the case of compat syscall ioctl numbers for UI_BEGIN_FF_UPLOAD and
UI_END_FF_UPLOAD need to be adjusted before being passed on
uinput_ioctl_handler() since code built with -m32 will be passing
slightly different values. Extend the code already covering
UI_SET_PHYS to cover UI_BEGIN_FF_UPLOAD and UI_END_FF_UPLOAD as well.

Reported-by: Pierre-Loup A. Griffais &lt;pgriffais@valvesoftware.com&gt;
Signed-off-by: Andrey Smirnov &lt;andrew.smirnov@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Input: uinput - fix undefined behavior in uinput_validate_absinfo()</title>
<updated>2019-01-31T07:13:45+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2019-01-14T21:54:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=28edadd147bfed92e3e16ed519ef098276935d94'/>
<id>urn:sha1:28edadd147bfed92e3e16ed519ef098276935d94</id>
<content type='text'>
commit d77651a227f8920dd7ec179b84e400cce844eeb3 upstream.

An integer overflow may arise in uinput_validate_absinfo() if "max - min"
can't be represented by an "int". We should check for overflow before
trying to use the result.

Reported-by: Kyungtae Kim &lt;kt0755@gmail.com&gt;
Reviewed-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Input: uinput - avoid crash when sending FF request to device going away</title>
<updated>2017-09-21T23:31:23+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2017-09-06T23:22:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6b4877c7bdc6ae39ce03716df7caeecf204697eb'/>
<id>urn:sha1:6b4877c7bdc6ae39ce03716df7caeecf204697eb</id>
<content type='text'>
If FF request comes in while uinput device is going away,
uinput_request_send() will fail with -ENODEV, and uinput_request_submit()
will attempt to mark the slot as unused by calling uinput_request_done().
Unfortunately in this case we haven't initialized request-&gt;done completion
yet, and we get a crash:

[   39.402036] BUG: spinlock bad magic on CPU#1, fftest/3108
[   39.402046]  lock: 0xffff88006a93bb00, .magic: 00000000, .owner: /39, .owner_cpu: 1217155072
[   39.402055] CPU: 1 PID: 3108 Comm: fftest Tainted: G        W 4.13.0+ #15
[   39.402059] Hardware name: LENOVO 20HQS0EG02/20HQS0EG02, BIOS N1MET37W (1.22 ) 07/04/2017
[   39.402064]  0000000000000086 f0fad82f3ceaa120 ffff88006a93b9a0 ffffffff9de941bb
[   39.402077]  ffff88026df8ae00 ffff88006a93bb00 ffff88006a93b9c0 ffffffff9dca62b7
[   39.402088]  ffff88006a93bb00 ffff88006a93baf8 ffff88006a93b9e0 ffffffff9dca62e7
[   39.402099] Call Trace:
[   39.402112]  [&lt;ffffffff9de941bb&gt;] dump_stack+0x4d/0x63
[   39.402123]  [&lt;ffffffff9dca62b7&gt;] spin_dump+0x97/0x9c
[   39.402130]  [&lt;ffffffff9dca62e7&gt;] spin_bug+0x2b/0x2d
[   39.402138]  [&lt;ffffffff9dca6373&gt;] do_raw_spin_lock+0x28/0xfd
[   39.402147]  [&lt;ffffffff9e3055cd&gt;] _raw_spin_lock_irqsave+0x19/0x1f
[   39.402154]  [&lt;ffffffff9dca05b7&gt;] complete+0x1d/0x48
[   39.402162]  [&lt;ffffffffc04f30af&gt;] 0xffffffffc04f30af
[   39.402167]  [&lt;ffffffffc04f468c&gt;] 0xffffffffc04f468c
[   39.402177]  [&lt;ffffffff9dd59c16&gt;] ? __slab_free+0x22f/0x359
[   39.402184]  [&lt;ffffffff9dcc13e9&gt;] ? tk_clock_read+0xc/0xe
[   39.402189]  [&lt;ffffffffc04f471f&gt;] 0xffffffffc04f471f
[   39.402195]  [&lt;ffffffff9dc9ffe5&gt;] ? __wake_up+0x44/0x4b
[   39.402200]  [&lt;ffffffffc04f3240&gt;] ? 0xffffffffc04f3240
[   39.402207]  [&lt;ffffffff9e0f57f3&gt;] erase_effect+0xa1/0xd2
[   39.402214]  [&lt;ffffffff9e0f58c6&gt;] input_ff_flush+0x43/0x5c
[   39.402219]  [&lt;ffffffffc04f32ad&gt;] 0xffffffffc04f32ad
[   39.402227]  [&lt;ffffffff9e0f174f&gt;] input_flush_device+0x3d/0x51
[   39.402234]  [&lt;ffffffff9e0f69ae&gt;] evdev_flush+0x49/0x5c
[   39.402243]  [&lt;ffffffff9dd62d6e&gt;] filp_close+0x3f/0x65
[   39.402253]  [&lt;ffffffff9dd7dcf7&gt;] put_files_struct+0x66/0xc1
[   39.402261]  [&lt;ffffffff9dd7ddeb&gt;] exit_files+0x47/0x4e
[   39.402270]  [&lt;ffffffff9dc6b329&gt;] do_exit+0x483/0x969
[   39.402278]  [&lt;ffffffff9dc73211&gt;] ? recalc_sigpending_tsk+0x3d/0x44
[   39.402285]  [&lt;ffffffff9dc6c7a2&gt;] do_group_exit+0x42/0xb0
[   39.402293]  [&lt;ffffffff9dc767e1&gt;] get_signal+0x58d/0x5bf
[   39.402300]  [&lt;ffffffff9dc03701&gt;] do_signal+0x37/0x53e
[   39.402307]  [&lt;ffffffff9e0f8401&gt;] ? evdev_ioctl_handler+0xac8/0xb04
[   39.402314]  [&lt;ffffffff9e0f8464&gt;] ? evdev_ioctl+0x10/0x12
[   39.402321]  [&lt;ffffffff9dd74cfa&gt;] ? do_vfs_ioctl+0x42e/0x501
[   39.402328]  [&lt;ffffffff9dc0170e&gt;] prepare_exit_to_usermode+0x66/0x90
[   39.402333]  [&lt;ffffffff9dc0181b&gt;] syscall_return_slowpath+0xe3/0xec
[   39.402339]  [&lt;ffffffff9e305b7b&gt;] int_ret_from_sys_call+0x25/0x8f

While we could solve this by simply initializing the completion earlier, we
are better off rearranging the code a bit so we avoid calling complete() on
requests that we did not send out. This patch consolidates marking request
slots as free in one place (in uinput_request_submit(), the same place
where we acquire them) and having everyone else simply signal completion
of the requests.

Fixes: 00ce756ce53a ("Input: uinput - mark failed submission requests as free")
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
</entry>
<entry>
<title>Input: uinput - avoid FF flush when destroying device</title>
<updated>2017-09-21T23:31:22+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2017-09-02T00:13:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e8b95728f724797f958912fd9b765a695595d3a6'/>
<id>urn:sha1:e8b95728f724797f958912fd9b765a695595d3a6</id>
<content type='text'>
Normally, when input device supporting force feedback effects is being
destroyed, we try to "flush" currently playing effects, so that the
physical device does not continue vibrating (or executing other effects).
Unfortunately this does not work well for uinput as flushing of the effects
deadlocks with the destroy action:

- if device is being destroyed because the file descriptor is being closed,
  then there is noone to even service FF requests;

- if device is being destroyed because userspace sent UI_DEV_DESTROY,
  while theoretically it could be possible to service FF requests,
  userspace is unlikely to do so (they'd need to make sure FF handling
  happens on a separate thread) even if kernel solves the issue with FF
  ioctls deadlocking with UI_DEV_DESTROY ioctl on udev-&gt;mutex.

To avoid lockups like the one below, let's install a custom input device
flush handler, and avoid trying to flush force feedback effects when we
destroying the device, and instead rely on uinput to shut off the device
properly.

NMI watchdog: Watchdog detected hard LOCKUP on cpu 3
...
 &lt;&lt;EOE&gt;&gt;  [&lt;ffffffff817a0307&gt;] _raw_spin_lock_irqsave+0x37/0x40
 [&lt;ffffffff810e633d&gt;] complete+0x1d/0x50
 [&lt;ffffffffa00ba08c&gt;] uinput_request_done+0x3c/0x40 [uinput]
 [&lt;ffffffffa00ba587&gt;] uinput_request_submit.part.7+0x47/0xb0 [uinput]
 [&lt;ffffffffa00bb62b&gt;] uinput_dev_erase_effect+0x5b/0x76 [uinput]
 [&lt;ffffffff815d91ad&gt;] erase_effect+0xad/0xf0
 [&lt;ffffffff815d929d&gt;] flush_effects+0x4d/0x90
 [&lt;ffffffff815d4cc0&gt;] input_flush_device+0x40/0x60
 [&lt;ffffffff815daf1c&gt;] evdev_cleanup+0xac/0xc0
 [&lt;ffffffff815daf5b&gt;] evdev_disconnect+0x2b/0x60
 [&lt;ffffffff815d74ac&gt;] __input_unregister_device+0xac/0x150
 [&lt;ffffffff815d75f7&gt;] input_unregister_device+0x47/0x70
 [&lt;ffffffffa00bac45&gt;] uinput_destroy_device+0xb5/0xc0 [uinput]
 [&lt;ffffffffa00bb2de&gt;] uinput_ioctl_handler.isra.9+0x65e/0x740 [uinput]
 [&lt;ffffffff811231ab&gt;] ? do_futex+0x12b/0xad0
 [&lt;ffffffffa00bb3f8&gt;] uinput_ioctl+0x18/0x20 [uinput]
 [&lt;ffffffff81241248&gt;] do_vfs_ioctl+0x298/0x480
 [&lt;ffffffff81337553&gt;] ? security_file_ioctl+0x43/0x60
 [&lt;ffffffff812414a9&gt;] SyS_ioctl+0x79/0x90
 [&lt;ffffffff817a04ee&gt;] entry_SYSCALL_64_fastpath+0x12/0x71

Reported-by: Rodrigo Rivas Costa &lt;rodrigorivascosta@gmail.com&gt;
Reported-by: Clément VUCHENER &lt;clement.vuchener@gmail.com&gt;
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=193741
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
</entry>
<entry>
<title>Input: uinput - fix crash when mixing old and new init style</title>
<updated>2017-02-01T18:33:11+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2017-01-31T22:56:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=601bbbe0517303c9f8eb3d75e11d64efed1293c9'/>
<id>urn:sha1:601bbbe0517303c9f8eb3d75e11d64efed1293c9</id>
<content type='text'>
If user tries to initialize uinput device mixing old and new style
initialization (i.e. using old UI_SET_ABSBIT instead of UI_ABS_SETUP,
we forget to allocate input-&gt;absinfo and will crash when trying to send
absolute events:

        ioctl(ui, UI_DEV_SETUP, &amp;us);
        ioctl(ui, UI_SET_PHYS, "Test");

        ioctl(ui, UI_SET_EVBIT, EV_ABS);
        ioctl(ui, UI_SET_ABSBIT, ABS_X);
        ioctl(ui, UI_SET_ABSBIT, ABS_Y);
        ioctl(ui, UI_DEV_CREATE, 0);

Reported-by: Rodrigo Rivas Costa &lt;rodrigorivascosta@gmail.com&gt;
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=191811
Fixes: fbae10db0940 ("Input: uinput - rework ABS validation")
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
</entry>
<entry>
<title>miscdevice: Add helper macro for misc device boilerplate</title>
<updated>2016-08-31T12:12:35+00:00</updated>
<author>
<name>PrasannaKumar Muralidharan</name>
<email>prasannatsmkumar@gmail.com</email>
</author>
<published>2016-08-25T17:00:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ca75d601b5942e8cf5eed68f308be0526d0dac5d'/>
<id>urn:sha1:ca75d601b5942e8cf5eed68f308be0526d0dac5d</id>
<content type='text'>
Many modules call misc_register and misc_deregister in its module init
and exit methods without any additional code. This ends up being
boilerplate. This patch adds helper macro module_misc_device(), that
replaces module_init()/ module_exit() with template functions.

This patch also converts drivers to use new macro.

Change since v1:
Add device.h include in miscdevice.h as module_driver macro was not
available from other include files in some architectures.

Signed-off-by: PrasannaKumar Muralidharan &lt;prasannatsmkumar@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input</title>
<updated>2016-05-28T02:14:35+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-05-28T02:14:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ed2608faa0f701b1dbc65277a9e5c7ff7118bfd4'/>
<id>urn:sha1:ed2608faa0f701b1dbc65277a9e5c7ff7118bfd4</id>
<content type='text'>
Pull more input subsystem updates from Dmitry Torokhov:
 "Just a few more driver fixes; new drivers will be coming in the next
  merge window"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: pwm-beeper - fix - scheduling while atomic
  Input: xpad - xbox one elite controller support
  Input: xpad - add more third-party controllers
  Input: xpad - prevent spurious input from wired Xbox 360 controllers
  Input: xpad - move pending clear to the correct location
  Input: uinput - handle compat ioctl for UI_SET_PHYS
</content>
</entry>
<entry>
<title>Input: uinput - handle compat ioctl for UI_SET_PHYS</title>
<updated>2016-05-20T18:00:43+00:00</updated>
<author>
<name>Ricky Liang</name>
<email>jcliang@chromium.org</email>
</author>
<published>2016-05-20T17:58:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=affa80bd97f7ca282d1faa91667b3ee9e4c590e6'/>
<id>urn:sha1:affa80bd97f7ca282d1faa91667b3ee9e4c590e6</id>
<content type='text'>
When running a 32-bit userspace on a 64-bit kernel, the UI_SET_PHYS
ioctl needs to be treated with special care, as it has the pointer
size encoded in the command.

Signed-off-by: Ricky Liang &lt;jcliang@chromium.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
</entry>
<entry>
<title>drivers/input: eliminate INPUT_COMPAT_TEST macro</title>
<updated>2016-03-25T23:37:42+00:00</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2016-03-25T21:20:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b8b4ead11e9d258ccc9a8aea28cc0ac747b044ef'/>
<id>urn:sha1:b8b4ead11e9d258ccc9a8aea28cc0ac747b044ef</id>
<content type='text'>
INPUT_COMPAT_TEST became much simpler after commit f4056b52845283
("input: redefine INPUT_COMPAT_TEST as in_compat_syscall()") so we can
cleanly eliminate it altogether.

Acked-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Cc: Andy Lutomirski &lt;luto@amacapital.net&gt;
Cc: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Input: uinput - sanity check on ff_effects_max and EV_FF</title>
<updated>2015-12-19T01:48:52+00:00</updated>
<author>
<name>Elias Vanderstuyft</name>
<email>elias.vds@gmail.com</email>
</author>
<published>2015-12-19T01:32:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=daf6cd0c1829c48cba197bd87d57fc8bf3f65faa'/>
<id>urn:sha1:daf6cd0c1829c48cba197bd87d57fc8bf3f65faa</id>
<content type='text'>
Currently the user can set ff_effects_max to zero with the EV_FF bit (and
the FF_GAIN and/or FF_AUTOCENTER bits) set, in this case the uninitialized
methods ff-&gt;set_gain and/or ff-&gt;set_autocenter can be dereferenced,
resulting in a kernel oops.

Check in uinput_create_device() and print a helpful message and return
-EINVAL in case the check fails.

Signed-off-by: Elias Vanderstuyft &lt;elias.vds@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
</entry>
</feed>
