]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpiolib: Fix line event handling in syscall compatible mode
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 15 Sep 2020 12:58:16 +0000 (15:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Oct 2020 06:02:54 +0000 (08:02 +0200)
commit115b0aed8b749e9435210d5b1d23ac16fa6658ef
treea6a09b41399896c8b188c11ded3f663ca69bba23
parentb4b93f8c92bbd870594c8e0a5b99c2c0640577dd
gpiolib: Fix line event handling in syscall compatible mode

[ Upstream commit 5ad284ab3a01e2d6a89be2a8663ae76f4e617549 ]

The introduced line event handling ABI in the commit

  61f922db7221 ("gpio: userspace ABI for reading GPIO line events")

missed the fact that 64-bit kernel may serve for 32-bit applications.
In such case the very first check in the lineevent_read() will fail
due to alignment differences.

To workaround this introduce lineevent_get_size() helper which returns actual
size of the structure in user space.

Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpiolib.c