]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpiolib: cdev: fix uninitialised kfifo
authorKent Gibson <warthog618@gmail.com>
Fri, 10 May 2024 06:53:42 +0000 (14:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:02:26 +0000 (12:02 +0200)
commit883e4bbf06eb5fb7482679e4edb201093e9f55a2
treea589e57bad0255614fe62389864cb8d9880a14ef
parent309364bc3205b36c2dd6a13ac04d1ea8b681e193
gpiolib: cdev: fix uninitialised kfifo

[ Upstream commit ee0166b637a5e376118e9659e5b4148080f1d27e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpiolib-cdev.c