CVE-2022-48975
gpiolib: fix memory leak in gpiochip_setup_dev()
Check your servers for CVE-2022-48975
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-48975 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
gpiolib: fix memory leak in gpiochip_setup_dev()
Here is a backtrace report about memory leak detected in gpiochip_setup_dev():
unreferenced object 0xffff88810b406400 (size 512): comm "python3", pid 1682, jiffies 4295346908 (age 24.090s) backtrace: kmalloc_trace device_add device_private_init at drivers/base/core.c:3361 (inlined by) device_add at drivers/base/core.c:3411 cdev_device_add gpiolib_cdev_register gpiochip_setup_dev gpiochip_add_data_with_key
gcdev_register() & gcdev_unregister() would call device_add() & device_del() (no matter CONFIG_GPIO_CDEV is enabled or not) to register/unregister device.
However, if device_add() succeeds, some resource (like struct device_private allocated by device_private_init()) is not released by device_del().
Therefore, after device_add() succeeds by gcdev_register(), it needs to call put_device() to release resource in the error handle path.
Here we move forward the register of release function, and let it release every piece of resource by put_device() instead of kfree().
While at it, fix another subtle issue, i.e. when gc->ngpio is equal to 0, we still call kcalloc() and, in case of further error, kfree() on the ZERO_PTR pointer, which is not NULL. It's not a bug per se, but rather waste of the resources and potentially wrong expectation about contents of the gdev->descs variable.
Exploitation
EPSS 0.25%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 17.1% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 22 Oct 2024):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 159f3cd92f17c61a4e2a47456de5865b114ef88e, before 6daaa84b621485fe28c401be18debf92ae8ef04a affected from 159f3cd92f17c61a4e2a47456de5865b114ef88e, before 371363716398ed718e389bea8c5e9843a79dde4e affected from 159f3cd92f17c61a4e2a47456de5865b114ef88e, before ec851b23084b3a0af8bf0f5e51d33a8d678bdc49
Other versions: unaffected
|
| Linux |
affected 4.6 unaffected before 4.6 unaffected from 5.15.83 up to and including 5.15.* unaffected from 6.0.13 up to and including 6.0.* unaffected 6.1 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2022-48975 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2022-48975
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2022-48975
trivy image --scanners vuln IMAGE | grep CVE-2022-48975
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/6daaa84b621485fe28c401be18debf92ae8ef04a git.kernel.org
- https://git.kernel.org/stable/c/371363716398ed718e389bea8c5e9843a79dde4e git.kernel.org
- https://git.kernel.org/stable/c/ec851b23084b3a0af8bf0f5e51d33a8d678bdc49 git.kernel.org
Source: the record CVE-2022-48975 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse