]> git.baikalelectronics.ru Git - kernel.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)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 17 Sep 2020 10:03:37 +0000 (12:03 +0200)
commit1d99bf1be37d26546b544fb72f8d70a794531b72
tree42a4ed0dc765611cecc4fc00a2e54604d5965c60
parent79452950438c760836e6a970a77b60aff1ddaacd
gpiolib: Fix line event handling in syscall compatible mode

The introduced line event handling ABI in the commit

  f79c945d61f1 ("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: f79c945d61f1 ("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>
drivers/gpio/gpiolib-cdev.c