# CVE-2022-49771: dm ioctl: fix misbehavior if list\_versions races with module loading

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

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; 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.19% (percentile 5, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-05-01T14:09:08.813Z
- **Modified:** 2026-11-05T20:17:09.657Z

## Who should check

- Anyone running Linux \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 0c8d4112df329bf3dfbf27693f918c3b08676538; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 6a818db0d5aecf80d4ba9e10ac153f60adc629ca; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 3a1c35d72dc0b34d1e746ed705790c0f630aa427; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< b545c0e1e4094d4de2bdfe9a3823f9154b0c0005; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< f59f5a269ca5e43c567aca7f1f52500a0186e9b7; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 6ffce7a92ef5c68f7e5d6f4d722c2f96280c064b; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 5398b8e275bf81a2517b327d216c0f37ac9ac5ae; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 4fe1ec995483737f3d2a14c3fe1d8fe634972979
- Anyone running Linux 2.6.12

## Description

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

dm ioctl: fix misbehavior if list\_versions races with module loading

\_\_list\_versions will first estimate the required space using the
"dm\_target\_iterate(list\_version\_get\_needed, &needed)" call and then will
fill the space using the "dm\_target\_iterate(list\_version\_get\_info,
&iter\_info)" call. Each of these calls locks the targets using the
"down\_read(&\_lock)" and "up\_read(&\_lock)" calls, however between the first
and second "dm\_target\_iterate" there is no lock held and the target
modules can be loaded at this point, so the second "dm\_target\_iterate"
call may need more space than what was the first "dm\_target\_iterate"
returned.

The code tries to handle this overflow (see the beginning of
list\_version\_get\_info), however this handling is incorrect.

The code sets "param-\>data\_size = param-\>data\_start + needed" and
"iter\_info.end = (char \*)vers+len" - "needed" is the size returned by the
first dm\_target\_iterate call; "len" is the size of the buffer allocated by
userspace.

"len" may be greater than "needed"; in this case, the code will write up
to "len" bytes into the buffer, however param-\>data\_size is set to
"needed", so it may write data past the param-\>data\_size value. The ioctl
interface copies only up to param-\>data\_size into userspace, thus part of
the result will be truncated.

Fix this bug by setting "iter\_info.end = (char \*)vers + needed;" - this
guarantees that the second "dm\_target\_iterate" call will write only up to
the "needed" buffer and it will exit with "DM\_BUFFER\_FULL\_FLAG" if it
overflows the "needed" space - in this case, userspace will allocate a
larger buffer and retry.

Note that there is also a bug in list\_version\_get\_needed - we need to add
"strlen(tt-\>name) + 1" to the needed size, not "strlen(tt-\>name)".

## Affected and fixed versions

- Linux: \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 0c8d4112df329bf3dfbf27693f918c3b08676538; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 6a818db0d5aecf80d4ba9e10ac153f60adc629ca; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 3a1c35d72dc0b34d1e746ed705790c0f630aa427; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< b545c0e1e4094d4de2bdfe9a3823f9154b0c0005; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< f59f5a269ca5e43c567aca7f1f52500a0186e9b7; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 6ffce7a92ef5c68f7e5d6f4d722c2f96280c064b; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 5398b8e275bf81a2517b327d216c0f37ac9ac5ae; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 4fe1ec995483737f3d2a14c3fe1d8fe634972979 (cvelist)
- Linux: 2.6.12 (cvelist)

## Mitigation

- Upgrade Linux to 4fe1ec995483737f3d2a14c3fe1d8fe634972979 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2022-49771.md
Affected: Linux >= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, < 0c8d4112df329bf3dfbf27693f918c3b08676538; >= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, < 6a818db0d5aecf80d4ba9e10ac153f60adc629ca; >= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, < 3a1c35d72dc0b34d1e746ed705790c0f630aa427; >= 1da177e4c3f41524e886b7f…
Fixed in: Linux 0c8d4112df329bf3dfbf27693f918c3b08676538, Linux 6a818db0d5aecf80d4ba9e10ac153f60adc629ca, Linux 3a1c35d72dc0b34d1e746ed705790c0f630aa427, Linux 6ffce7a92ef5c68f7e5d6f4d722c2f96280c064b, Linux 5398b8e275bf81a2517b327d216c0f37ac9ac5ae, Linux 4fe1ec995483737f3d2a14c3fe1d8fe634972979

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-2022-49771 being exploited?

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

### How serious is CVE-2022-49771?

Medium: CVSS 4.7 (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-2022-49771?

Linux \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 0c8d4112df329bf3dfbf27693f918c3b08676538; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 6a818db0d5aecf80d4ba9e10ac153f60adc629ca; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 3a1c35d72dc0b34d1e746ed705790c0f630aa427; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< b545c0e1e4094d4de2bdfe9a3823f9154b0c0005; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< f59f5a269ca5e43c567aca7f1f52500a0186e9b7; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 6ffce7a92ef5c68f7e5d6f4d722c2f96280c064b; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 5398b8e275bf81a2517b327d216c0f37ac9ac5ae; \>= 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, \< 4fe1ec995483737f3d2a14c3fe1d8fe634972979; Linux 2.6.12.

### Is there a fix for CVE-2022-49771?

Yes. Fixed in Linux 0c8d4112df329bf3dfbf27693f918c3b08676538, Linux 6a818db0d5aecf80d4ba9e10ac153f60adc629ca, Linux 3a1c35d72dc0b34d1e746ed705790c0f630aa427, Linux 6ffce7a92ef5c68f7e5d6f4d722c2f96280c064b, Linux 5398b8e275bf81a2517b327d216c0f37ac9ac5ae, Linux 4fe1ec995483737f3d2a14c3fe1d8fe634972979. Upgrade Linux to 4fe1ec995483737f3d2a14c3fe1d8fe634972979 or later.

### How do I check if I'm affected by CVE-2022-49771?

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/0c8d4112df329bf3dfbf27693f918c3b08676538>
- patch: <https://git.kernel.org/stable/c/6a818db0d5aecf80d4ba9e10ac153f60adc629ca>
- patch: <https://git.kernel.org/stable/c/3a1c35d72dc0b34d1e746ed705790c0f630aa427>
- patch: <https://git.kernel.org/stable/c/b545c0e1e4094d4de2bdfe9a3823f9154b0c0005>
- patch: <https://git.kernel.org/stable/c/f59f5a269ca5e43c567aca7f1f52500a0186e9b7>
- patch: <https://git.kernel.org/stable/c/6ffce7a92ef5c68f7e5d6f4d722c2f96280c064b>
- patch: <https://git.kernel.org/stable/c/5398b8e275bf81a2517b327d216c0f37ac9ac5ae>
- patch: <https://git.kernel.org/stable/c/4fe1ec995483737f3d2a14c3fe1d8fe634972979>

## 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-2022-49771>

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