Input: evdev - call input_flush_device() on release(), not flush()
authorBrendan Shanks <bshanks@codeweavers.com>
Wed, 22 Apr 2020 20:45:12 +0000 (13:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jun 2020 06:21:16 +0000 (08:21 +0200)
commit9abf0403a70971fcbac1dba1b3d83c34481c761a
treed53ec1c49221cfeba686683c6a308512c41eac87
parent5a273fa5622961cfe89dd1192602f0f6be876bb6
Input: evdev - call input_flush_device() on release(), not flush()

[ Upstream commit 09264098ff153f60866039d60b31d39b66f55a31 ]

input_flush_device() should only be called once the struct file is being
released and no open descriptors remain, but evdev_flush() was calling
it whenever a file descriptor was closed.

This caused uploaded force-feedback effects to be erased when a process
did a dup()/close() on the event FD, called system(), etc.

Call input_flush_device() from evdev_release() instead.

Reported-by: Mathieu Maret <mathieu.maret@gmail.com>
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Link: https://lore.kernel.org/r/20200421231003.7935-1-bshanks@codeweavers.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/input/evdev.c