# CVE-2024-36899: gpiolib: cdev: Fix use after free in lineinfo\_changed\_notify

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.0
- **CVSS:** 7.0 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.24% (percentile 9, 2026-11-26)
- **CWE:** CWE-362, CWE-416
- **Published:** 2024-05-30T15:29:02.591Z
- **Modified:** 2026-10-15T01:18:23.673Z

## Who should check

- Anyone running Linux \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 2dfbb920a89bdc58087672ad5325dc6c588b6860; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 2d008d4961b039d2edce8976289773961b7e5fb5; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< d38c49f7bdf14381270736299e2ff68ec248a017; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 95ca7c90eaf5ea8a8460536535101e3e81160e2a; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< ca710b5f40b8b16fdcad50bebd47f50e4c62d239; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 02f6b0e1ec7e0e7d059dddc893645816552039da
- Anyone running Linux 5.7

## Description

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

gpiolib: cdev: Fix use after free in lineinfo\_changed\_notify

The use-after-free issue occurs as follows: when the GPIO chip device file
is being closed by invoking gpio\_chrdev\_release(), watched\_lines is freed
by bitmap\_free(), but the unregistration of lineinfo\_changed\_nb notifier
chain failed due to waiting write rwsem. Additionally, one of the GPIO
chip's lines is also in the release process and holds the notifier chain's
read rwsem. Consequently, a race condition leads to the use-after-free of
watched\_lines.

Here is the typical stack when issue happened:

\[free\]
gpio\_chrdev\_release()
  --\> bitmap\_free(cdev-\>watched\_lines)                  \<-- freed
  --\> blocking\_notifier\_chain\_unregister()
    --\> down\_write(&nh-\>rwsem)                          \<-- waiting rwsem
          --\> \_\_down\_write\_common()
            --\> rwsem\_down\_write\_slowpath()
                  --\> schedule\_preempt\_disabled()
                    --\> schedule()

\[use\]
st54spi\_gpio\_dev\_release()
  --\> gpio\_free()
    --\> gpiod\_free()
      --\> gpiod\_free\_commit()
        --\> gpiod\_line\_state\_notify()
          --\> blocking\_notifier\_call\_chain()
            --\> down\_read(&nh-\>rwsem);                  \<-- held rwsem
            --\> notifier\_call\_chain()
              --\> lineinfo\_changed\_notify()
                --\> test\_bit(xxxx, cdev-\>watched\_lines) \<-- use after free

The side effect of the use-after-free issue is that a GPIO line event is
being generated for userspace where it shouldn't. However, since the chrdev
is being closed, userspace won't have the chance to read that event anyway.

To fix the issue, call the bitmap\_free() function after the unregistration
of lineinfo\_changed\_nb notifier chain.

## Affected and fixed versions

- Linux: \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 2dfbb920a89bdc58087672ad5325dc6c588b6860; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 2d008d4961b039d2edce8976289773961b7e5fb5; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< d38c49f7bdf14381270736299e2ff68ec248a017; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 95ca7c90eaf5ea8a8460536535101e3e81160e2a; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< ca710b5f40b8b16fdcad50bebd47f50e4c62d239; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 02f6b0e1ec7e0e7d059dddc893645816552039da (cvelist)
- Linux: 5.7 (cvelist)

## Mitigation

- Upgrade Linux to 02f6b0e1ec7e0e7d059dddc893645816552039da or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-36899. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-36899.md
Affected: Linux >= 51c1064e82e77b39a49889287ca50709303e2f26, < 2dfbb920a89bdc58087672ad5325dc6c588b6860; >= 51c1064e82e77b39a49889287ca50709303e2f26, < 2d008d4961b039d2edce8976289773961b7e5fb5; >= 51c1064e82e77b39a49889287ca50709303e2f26, < d38c49f7bdf14381270736299e2ff68ec248a017; >= 51c1064e82e77b39a498892…
Fixed in: Linux 2dfbb920a89bdc58087672ad5325dc6c588b6860, Linux 2d008d4961b039d2edce8976289773961b7e5fb5, Linux 95ca7c90eaf5ea8a8460536535101e3e81160e2a, Linux 02f6b0e1ec7e0e7d059dddc893645816552039da

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-36899 being exploited?

There is no confirmed exploitation: CVE-2024-36899 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.24% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-36899?

High: CVSS 7.0 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2024-36899?

Linux \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 2dfbb920a89bdc58087672ad5325dc6c588b6860; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 2d008d4961b039d2edce8976289773961b7e5fb5; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< d38c49f7bdf14381270736299e2ff68ec248a017; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 95ca7c90eaf5ea8a8460536535101e3e81160e2a; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< ca710b5f40b8b16fdcad50bebd47f50e4c62d239; \>= 51c1064e82e77b39a49889287ca50709303e2f26, \< 02f6b0e1ec7e0e7d059dddc893645816552039da; Linux 5.7.

### Is there a fix for CVE-2024-36899?

Yes. Fixed in Linux 2dfbb920a89bdc58087672ad5325dc6c588b6860, Linux 2d008d4961b039d2edce8976289773961b7e5fb5, Linux 95ca7c90eaf5ea8a8460536535101e3e81160e2a, Linux 02f6b0e1ec7e0e7d059dddc893645816552039da. Upgrade Linux to 02f6b0e1ec7e0e7d059dddc893645816552039da or later.

### How do I check if I'm affected by CVE-2024-36899?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/95ca7c90eaf5ea8a8460536535101e3e81160e2a>
- patch: <https://git.kernel.org/stable/c/ca710b5f40b8b16fdcad50bebd47f50e4c62d239>
- patch: <https://git.kernel.org/stable/c/02f6b0e1ec7e0e7d059dddc893645816552039da>
- other: <https://git.kernel.org/stable/c/2dfbb920a89bdc58087672ad5325dc6c588b6860>
- other: <https://git.kernel.org/stable/c/2d008d4961b039d2edce8976289773961b7e5fb5>
- other: <https://git.kernel.org/stable/c/d38c49f7bdf14381270736299e2ff68ec248a017>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-265688.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-36899>

HTML: <https://flawdb.com/CVE-2024-36899> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-36899>
