Skip to main content

Linux CVE-2025-21739

HIGH
Use After Free (CWE-416)
2025-02-27 416baaa9-dc9f-4396-8d5f-8c081fb06d67
7.8
CVSS 3.1 · NVD
Share

Severity by source

NVD PRIMARY
7.8 HIGH
AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SUSE
HIGH
qualitative
Red Hat
6.7 MEDIUM
qualitative

Primary rating from NVD.

CVSS VectorNVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

5
Analysis Updated
Apr 18, 2026 - 09:47 vuln.today
v2 (cvss_changed)
Re-analysis Queued
Apr 18, 2026 - 09:22 vuln.today
cvss_changed
Analysis Generated
Mar 28, 2026 - 18:28 vuln.today
Patch released
Mar 28, 2026 - 18:28 nvd
Patch available
CVE Published
Feb 27, 2025 - 03:15 nvd
HIGH 7.8

DescriptionCVE.org

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

scsi: ufs: core: Fix use-after free in init error and remove paths

devm_blk_crypto_profile_init() registers a cleanup handler to run when the associated (platform-) device is being released. For UFS, the crypto private data and pointers are stored as part of the ufs_hba's data structure 'struct ufs_hba::crypto_profile'. This structure is allocated as part of the underlying ufshcd and therefore Scsi_host allocation.

During driver release or during error handling in ufshcd_pltfrm_init(), this structure is released as part of ufshcd_dealloc_host() before the (platform-) device associated with the crypto call above is released. Once this device is released, the crypto cleanup code will run, using the just-released 'struct ufs_hba::crypto_profile'. This causes a use-after-free situation:

Call trace: kfree+0x60/0x2d8 (P) kvfree+0x44/0x60 blk_crypto_profile_destroy_callback+0x28/0x70 devm_action_release+0x1c/0x30 release_nodes+0x6c/0x108 devres_release_all+0x98/0x100 device_unbind_cleanup+0x20/0x70 really_probe+0x218/0x2d0

In other words, the initialisation code flow is:

platform-device probe ufshcd_pltfrm_init() ufshcd_alloc_host() scsi_host_alloc() allocation of struct ufs_hba creation of scsi-host devices devm_blk_crypto_profile_init() devm registration of cleanup handler using platform-device

and during error handling of ufshcd_pltfrm_init() or during driver removal:

ufshcd_dealloc_host() scsi_host_put() put_device(scsi-host) release of struct ufs_hba put_device(platform-device) crypto cleanup handler

To fix this use-after free, change ufshcd_alloc_host() to register a devres action to automatically cleanup the underlying SCSI device on ufshcd destruction, without requiring explicit calls to ufshcd_dealloc_host(). This way:

  • the crypto profile and all other ufs_hba-owned resources are

destroyed before SCSI (as they've been registered after)

  • a memleak is plugged in tc-dwc-g210-pci.c remove() as a

side-effect

  • EXPORT_SYMBOL_GPL(ufshcd_dealloc_host) can be removed fully as

it's not needed anymore

  • no future drivers using ufshcd_alloc_host() could ever forget

adding the cleanup

AnalysisAI

Use-after-free in Linux kernel UFS driver (versions 6.14-rc1 and earlier) allows local authenticated attackers to achieve arbitrary code execution, information disclosure, or denial of service. The flaw occurs during driver initialization error handling and removal paths when the crypto profile structure is freed before the device cleanup handler runs. Patches available from kernel.org (commits 0c77c0d, 9c185be, f8fb240) and distributions (Red Hat RHSA-2025:20518, multiple SUSE advisories). EPSS score 0.04% indicates low observed exploitation probability; no public exploit code or CISA KEV listing confirmed.

Technical ContextAI

The vulnerability exists in the Linux kernel SCSI UFS (Universal Flash Storage) subsystem, specifically in the ufshcd platform driver's device management code. The root cause is a CWE-416 use-after-free race condition between device resource cleanup ordering. The devm_blk_crypto_profile_init() function registers a cleanup handler tied to the platform device's lifecycle, but the crypto_profile structure itself is embedded within ufs_hba, which is allocated as part of the SCSI host and freed via scsi_host_put(). During error handling in ufshcd_pltfrm_init() or normal driver removal via ufshcd_dealloc_host(), the SCSI host (and embedded ufs_hba) is freed first, then the platform device release triggers blk_crypto_profile_destroy_callback() which accesses the already-freed crypto_profile memory. The fix restructures resource management using devres actions to ensure correct cleanup ordering: crypto profile resources are destroyed before the SCSI host they depend on.

RemediationAI

Apply vendor-released kernel patches immediately. Upstream fixes confirmed in kernel commits 0c77c0d754fe (https://git.kernel.org/stable/c/0c77c0d754fe83cb154715fcfec6c3faef94f207), 9c185beae09a (https://git.kernel.org/stable/c/9c185beae09a3eb85f54777edafa227f7e03075d), and f8fb2403ddeb (https://git.kernel.org/stable/c/f8fb2403ddebb5eea0033d90d9daae4c88749ada). For Red Hat systems, install updates from RHSA-2025:20518. For SUSE systems, apply relevant SUSE-SU advisories based on your kernel version. The fix restructures ufshcd_alloc_host() to use devres actions for automatic cleanup ordering, eliminating the need for explicit ufshcd_dealloc_host() calls and preventing future similar issues. No practical workarounds exist short of disabling UFS driver loading (modprobe blacklist ufshcd-core), which would render UFS storage devices unusable - acceptable only if no critical data resides on UFS volumes and alternative storage is available. Organizations unable to patch immediately should restrict physical access to affected systems and monitor for unexpected UFS driver reload attempts via kernel logs (dmesg | grep ufshcd), though this provides minimal security value against a determined local attacker.

Vendor StatusVendor

SUSE

Severity: High
Product Status
Container suse/hpc/warewulf4-x86_64/sle-hpc-node:15.7.20.5.1 Image SLES15-SP7-BYOS-Azure Image SLES15-SP7-BYOS-EC2 Image SLES15-SP7-BYOS-GCE Image SLES15-SP7-CHOST-BYOS-Aliyun Image SLES15-SP7-CHOST-BYOS-Azure Image SLES15-SP7-CHOST-BYOS-EC2 Image SLES15-SP7-CHOST-BYOS-GCE Image SLES15-SP7-CHOST-BYOS-GDC Image SLES15-SP7-CHOST-BYOS-SAP-CCloud Image SLES15-SP7-EC2 Image SLES15-SP7-EC2-ECS-HVM Image SLES15-SP7-GCE Image SLES15-SP7-GCE-3P Image SLES15-SP7-HPC-BYOS-Azure Image SLES15-SP7-HPC-BYOS-EC2 Image SLES15-SP7-HPC-BYOS-GCE Image SLES15-SP7-Hardened-BYOS-Azure Image SLES15-SP7-Hardened-BYOS-EC2 Image SLES15-SP7-Hardened-BYOS-GCE Image SLES15-SP7-SAPCAL-Azure Image SLES15-SP7-SAPCAL-EC2 Image SLES15-SP7-SAPCAL-GCE Affected
Container suse/sl-micro/6.0/base-os-container:2.1.3-6.11 Container suse/sl-micro/6.1/base-os-container:2.2.0-4.21 Image SL-Micro Image SL-Micro-Azure Image SL-Micro-BYOS-Azure Image SL-Micro-BYOS-EC2 Image SL-Micro-BYOS-GCE Image SL-Micro-EC2 Image SLE-Micro Image SLE-Micro-Azure Image SLE-Micro-BYOS Image SLE-Micro-BYOS-Azure Image SLE-Micro-BYOS-EC2 Image SLE-Micro-BYOS-GCE Image SLE-Micro-EC2 Image SLE-Micro-GCE Image SUSE-Multi-Linux-Manager-Proxy-BYOS-Azure Image SUSE-Multi-Linux-Manager-Proxy-BYOS-EC2 Image SUSE-Multi-Linux-Manager-Proxy-BYOS-GCE Image SUSE-Multi-Linux-Manager-Server-Azure-llc Image SUSE-Multi-Linux-Manager-Server-Azure-ltd Image SUSE-Multi-Linux-Manager-Server-BYOS-Azure Image SUSE-Multi-Linux-Manager-Server-BYOS-EC2 Image SUSE-Multi-Linux-Manager-Server-BYOS-GCE Image SUSE-Multi-Linux-Manager-Server-EC2-llc Image SUSE-Multi-Linux-Manager-Server-EC2-ltd Affected
Container suse/sl-micro/6.0/kvm-os-container:2.1.3-6.12 Container suse/sl-micro/6.1/kvm-os-container:2.2.0-4.20 Affected
Container suse/sl-micro/6.0/rt-os-container:2.1.3-7.15 Container suse/sl-micro/6.1/rt-os-container:2.2.0-4.21 Affected
Image SLES15-SP6-BYOS Image SLES15-SP6-BYOS-Azure Image SLES15-SP6-BYOS-EC2 Image SLES15-SP6-BYOS-GCE Image SLES15-SP6-CHOST-BYOS Image SLES15-SP6-CHOST-BYOS-Aliyun Image SLES15-SP6-CHOST-BYOS-Azure Image SLES15-SP6-CHOST-BYOS-EC2 Image SLES15-SP6-CHOST-BYOS-GCE Image SLES15-SP6-CHOST-BYOS-GDC Image SLES15-SP6-CHOST-BYOS-SAP-CCloud Image SLES15-SP6-EC2 Image SLES15-SP6-EC2-ECS-HVM Image SLES15-SP6-GCE Image SLES15-SP6-HPC-BYOS Image SLES15-SP6-HPC-BYOS-Azure Image SLES15-SP6-HPC-BYOS-EC2 Image SLES15-SP6-HPC-BYOS-GCE Image SLES15-SP6-HPC-EC2 Image SLES15-SP6-HPC-GCE Image SLES15-SP6-Hardened-BYOS Image SLES15-SP6-Hardened-BYOS-Azure Image SLES15-SP6-Hardened-BYOS-EC2 Image SLES15-SP6-Hardened-BYOS-GCE Image SLES15-SP6-SAP Image SLES15-SP6-SAP-Azure Image SLES15-SP6-SAP-EC2 Image SLES15-SP6-SAP-GCE Image SLES15-SP6-SAPCAL Image SLES15-SP6-SAPCAL-Azure Image SLES15-SP6-SAPCAL-EC2 Image SLES15-SP6-SAPCAL-GCE Affected

Share

CVE-2025-21739 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy