]> git.dujemihanovic.xyz Git - linux.git/commit
gpiolib: cdev: fix uninitialised kfifo
authorKent Gibson <warthog618@gmail.com>
Fri, 10 May 2024 06:53:42 +0000 (14:53 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 10 May 2024 14:38:27 +0000 (16:38 +0200)
commitee0166b637a5e376118e9659e5b4148080f1d27e
treef64fcc73ef03a65eaf151c830743009509cb84fe
parent02f6b0e1ec7e0e7d059dddc893645816552039da
gpiolib: cdev: fix uninitialised kfifo

If a line is requested with debounce, and that results in debouncing
in software, and the line is subsequently reconfigured to enable edge
detection then the allocation of the kfifo to contain edge events is
overlooked.  This results in events being written to and read from an
uninitialised kfifo.  Read events are returned to userspace.

Initialise the kfifo in the case where the software debounce is
already active.

Fixes: 65cff7046406 ("gpiolib: cdev: support setting debounce")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240510065342.36191-1-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib-cdev.c