<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/input/misc/uinput.c, branch v3.16.76</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v3.16.76</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v3.16.76'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2019-10-05T15:19:45+00:00</updated>
<entry>
<title>Input: uinput - add compat ioctl number translation for UI_*_FF_UPLOAD</title>
<updated>2019-10-05T15:19:45+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=ddbddae7155ad5921a69ef5d1ebd8328cd9f8b16'/>
<id>urn:sha1:ddbddae7155ad5921a69ef5d1ebd8328cd9f8b16</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;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>Input: uinput - avoid crash when sending FF request to device going away</title>
<updated>2018-01-01T20:51:36+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=c6e48871d9da941df7ce17ed0e2fafea00292eab'/>
<id>urn:sha1:c6e48871d9da941df7ce17ed0e2fafea00292eab</id>
<content type='text'>
commit 6b4877c7bdc6ae39ce03716df7caeecf204697eb upstream.

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;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>Input: uinput - avoid FF flush when destroying device</title>
<updated>2018-01-01T20:51:36+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=0c4413414480a84065b566fe0a098fca2ffcf373'/>
<id>urn:sha1:0c4413414480a84065b566fe0a098fca2ffcf373</id>
<content type='text'>
commit e8b95728f724797f958912fd9b765a695595d3a6 upstream.

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;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>Input: uinput - handle compat ioctl for UI_SET_PHYS</title>
<updated>2016-08-22T21:38:03+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=285d720c9845f52168affde139246b204f07d4b8'/>
<id>urn:sha1:285d720c9845f52168affde139246b204f07d4b8</id>
<content type='text'>
commit affa80bd97f7ca282d1faa91667b3ee9e4c590e6 upstream.

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;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>Input: uinput - add UI_GET_SYSNAME ioctl to retrieve the sysfs path</title>
<updated>2014-02-12T23:00:34+00:00</updated>
<author>
<name>Benjamin Tissoires</name>
<email>benjamin.tissoires@redhat.com</email>
</author>
<published>2014-01-31T01:20:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e3480a61fca72d40d6dc4baaf37e94fcbfa95e19'/>
<id>urn:sha1:e3480a61fca72d40d6dc4baaf37e94fcbfa95e19</id>
<content type='text'>
uinput is used in the xorg-integration-tests suite and in the wayland
test suite. These automated tests suites create many virtual input
devices and then hook something to read these newly created devices.

Currently, uinput does not provide the created input device, which means
that we rely on an heuristic to guess which input node was created.
The problem is that is heuristic is subjected to races between different
uinput devices or even with physical devices. Having a way to retrieve
the sysfs path allows us to find without any doubts the event node.

Signed-off-by: Benjamin Tissoires &lt;benjamin.tissoires@redhat.com&gt;
Reviewed-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: uinput - breaks by goto out in uinput_ioctl_handler</title>
<updated>2014-01-31T01:30:57+00:00</updated>
<author>
<name>Benjamin Tisssoires</name>
<email>benjamin.tissoires@redhat.com</email>
</author>
<published>2014-01-31T01:16:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9d51e801dba0c79ae979ef2f6928e402eb41009b'/>
<id>urn:sha1:9d51e801dba0c79ae979ef2f6928e402eb41009b</id>
<content type='text'>
The current implementation prevents us to add variable-length ioctl.
Use a bunch of gotos instead of break to allow us to do so.

No functional changes.

Signed-off-by: Benjamin Tisssoires &lt;benjamin.tissoires@redhat.com&gt;
Reviewed-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: uinput - support injecting multiple events in one write() call</title>
<updated>2013-09-19T15:57:56+00:00</updated>
<author>
<name>Ryan Mallon</name>
<email>rmallon@gmail.com</email>
</author>
<published>2013-09-18T19:40:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cbf0541374e2fcfdfdcaf8365c957a137eb9feea'/>
<id>urn:sha1:cbf0541374e2fcfdfdcaf8365c957a137eb9feea</id>
<content type='text'>
Rework the code in uinput_inject_event so that it matches the code in
evdev_write and allows injecting more than one event, or zero events.

Signed-off-by: Ryan Mallon &lt;rmallon@gmail.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-next' of git://github.com/rydberg/linux into next</title>
<updated>2012-10-01T21:40:51+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-10-01T21:40:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7774036808011ceecc88cef01dfafcce39ed9fc5'/>
<id>urn:sha1:7774036808011ceecc88cef01dfafcce39ed9fc5</id>
<content type='text'>
Merge Henrik's updates to multitouch code. Even though Jiri already
pulled them in I need to do it too since my changes to evdev using
dynamic major would clash with them.
</content>
</entry>
<entry>
<title>Input: MT - Add flags to input_mt_init_slots()</title>
<updated>2012-09-19T17:50:18+00:00</updated>
<author>
<name>Henrik Rydberg</name>
<email>rydberg@euromail.se</email>
</author>
<published>2012-08-11T20:07:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b4adbbefc2099476a4f1020041c99f52cf3cd67d'/>
<id>urn:sha1:b4adbbefc2099476a4f1020041c99f52cf3cd67d</id>
<content type='text'>
Preparing to move more repeated code into the mt core, add a flags
argument to the input_mt_slots_init() function.

Reviewed-and-tested-by: Benjamin Tissoires &lt;benjamin.tissoires@enac.fr&gt;
Tested-by: Ping Cheng &lt;pingc@wacom.com&gt;
Acked-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
</content>
</entry>
<entry>
<title>Input: uinput - fix formatting</title>
<updated>2012-08-22T05:29:55+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2012-07-30T05:48:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=54ce165ebd9d9494b64149e0d1ab4ddbf5ea908b'/>
<id>urn:sha1:54ce165ebd9d9494b64149e0d1ab4ddbf5ea908b</id>
<content type='text'>
Reformat the code to keep it within 80 columns.

Signed-off-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
</content>
</entry>
</feed>
