Subject: CVE-2024-36898: gpiolib: cdev: fix uninitialised kfifo

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

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.

The Linux kernel CVE team has assigned CVE-2024-36898 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.10 with commit 65cff7046406 and fixed in 6.1.91 with commit 1a51e24404d7
	Issue introduced in 5.10 with commit 65cff7046406 and fixed in 6.6.31 with commit 883e4bbf06eb
	Issue introduced in 5.10 with commit 65cff7046406 and fixed in 6.8.10 with commit bd7139a70ee8
	Issue introduced in 5.10 with commit 65cff7046406 and fixed in 6.9 with commit ee0166b637a5

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-36898
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/gpio/gpiolib-cdev.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/1a51e24404d77bb3307c1e39eee0d8e86febb1a5
	https://git.kernel.org/stable/c/883e4bbf06eb5fb7482679e4edb201093e9f55a2
	https://git.kernel.org/stable/c/bd7139a70ee8d8ea872b223e043730cf6f5e2b0e
	https://git.kernel.org/stable/c/ee0166b637a5e376118e9659e5b4148080f1d27e