CVE-2022-49549

x86/MCE/AMD: Fix memory leak when threshold_create_bank() fails

State
Published
Severity
5.5 Medium
Published
Feb 26, 2025
Updated
May 11, 2026
Reserved
Feb 26, 2025

Read the record on cve.org

Description

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

x86/MCE/AMD: Fix memory leak when threshold_create_bank() fails

In mce_threshold_create_device(), if threshold_create_bank() fails, the previously allocated threshold banks array @bp will be leaked because the call to mce_threshold_remove_device() will not free it.

This happens because mce_threshold_remove_device() fetches the pointer through the threshold_banks per-CPU variable but bp is written there only after the bank creation is successful, and not before, when threshold_create_bank() fails.

Add a helper which unwinds all the bank creation work previously done and pass into it the previously allocated threshold banks array for freeing.

[ bp: Massage. ]

Scores

CVSSScoreVectorSource
3.15.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:HCISA-ADP

Weaknesses

  • CWE-401 Missing Release of Memory after Effective Lifetime

Affected Products

ProductVersions
LinuxLinux
  • 6458de97fc15530b54477c4e2b70af653e8ac3d9 to before b4acb8e7f1594607bc9017ef0aacb40b24a003d6Affected
  • 6458de97fc15530b54477c4e2b70af653e8ac3d9 to before cc0dd4456f9573bf8af9b4d8754433918e809e1eAffected
  • 6458de97fc15530b54477c4e2b70af653e8ac3d9 to before 9708f1956eeb70c86943e0bc62fa3b0101b59616Affected
  • 6458de97fc15530b54477c4e2b70af653e8ac3d9 to before 396b8e7ab2a99ddac57d3522b3da5e58cb608d37Affected
  • 6458de97fc15530b54477c4e2b70af653e8ac3d9 to before e5f28623ceb103e13fc3d7bd45edf9818b227fd0Affected
LinuxLinux
  • 5.8Affected
  • before 5.8Not affected
  • 5.10.121 through 5.10.*Not affected
  • 5.15.46 through 5.15.*Not affected
  • 5.17.14 through 5.17.*Not affected
  • 5.18.3 through 5.18.*Not affected
  • 5.19 and laterNot affected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.