Skip to contentSkip to conversation

CVE-2025-21783: gpiolib: Fix crash on error in gpiochip_get_ngpios()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Feb 27, 2025

lore
Share & tools
lore
#0 lore raw

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

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

gpiolib: Fix crash on error in gpiochip_get_ngpios()

The gpiochip_get_ngpios() uses chip_*() macros to print messages. However these macros rely on gpiodev to be initialised and set, which is not the case when called via bgpio_init(). In such a case the printing messages will crash on NULL pointer dereference. Replace chip_*() macros by the respective dev_*() ones to avoid such crash.

The Linux kernel CVE team has assigned CVE-2025-21783 to this issue.

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

	Issue introduced in 6.6 with commit 55b2395e4e92adc492c6b30ac109eb78250dcd9d and fixed in 6.6.79 with commit 4d9b2b62e1136d10f661ec4c0c268140b6f74f4f
	Issue introduced in 6.6 with commit 55b2395e4e92adc492c6b30ac109eb78250dcd9d and fixed in 6.12.16 with commit a7052afa9eae2239e25943baa8817a6a56e8aa68
	Issue introduced in 6.6 with commit 55b2395e4e92adc492c6b30ac109eb78250dcd9d and fixed in 6.13.4 with commit 189fb76215e479c10731baabb50f1a352d2078f5
	Issue introduced in 6.6 with commit 55b2395e4e92adc492c6b30ac109eb78250dcd9d and fixed in 6.14-rc3 with commit 7b4aebeecbbd5b5fe73e35fad3f62ed21aa7ef44

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-2025-21783

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.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/4d9b2b62e1136d10f661ec4c0c268140b6f74f4f
	https://git.kernel.org/stable/c/a7052afa9eae2239e25943baa8817a6a56e8aa68
	https://git.kernel.org/stable/c/189fb76215e479c10731baabb50f1a352d2078f5
	https://git.kernel.org/stable/c/7b4aebeecbbd5b5fe73e35fad3f62ed21aa7ef44