Skip to content
Heist/ feed
Back to feed
HighFix available

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

Type: advisorySources: OSV

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_dev

Products
Kernel
Affected versions
Not specified
Fixed versions
5.15.209, 6.1.175, 6.12.14, 6.13.3, 6.6.135
CVEs
CVE-2025-21739
Confirmed fixed CVEs
Not specified
Updated in this feed
8 Nov 2026, 01:52 UTC · Revision 1

Source evidence

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

core-osv · Original source

Published 27 Feb 2025, 02:12 UTC

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_dev

osv:CVE-2025-21739

Kernel

Fixed versions: 5.15.209, 6.1.175, 6.6.135, 6.12.14, 6.13.3

Complete source record
{
  "id": "5840853067d3a0dc16ed5ff2745944d7c0f0959dd473cde3ba3e1ea16a546059",
  "url": "https://osv.dev/vulnerability/CVE-2025-21739",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "scsi: ufs: core: Fix use-after free in init error and remove paths",
    "summary": "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_dev",
    "evidence": "osv:CVE-2025-21739",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "5.15.209",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.1.175",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.6.135",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.12.14",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.13.3",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "CVE-2025-21739",
      "aliases": [
        "CVE-2025-21739"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "d76d9d7d1009968dd3a0fc30e5f5ee9fbffc1350"
                },
                {
                  "fixed": "0a6895c03b1f439236e2d22b1a69ebfc1eb9d5ea"
                },
                {
                  "fixed": "d06eb2620d3bf16056b8b7ea3744dbb5e30512f4"
                },
                {
                  "fixed": "0dc539b888fb5f56b6eeddd95433eab557d4b0c1"
                },
                {
                  "fixed": "0c77c0d754fe83cb154715fcfec6c3faef94f207"
                },
                {
                  "fixed": "9c185beae09a3eb85f54777edafa227f7e03075d"
                },
                {
                  "fixed": "f8fb2403ddebb5eea0033d90d9daae4c88749ada"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21739.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.12.0"
                },
                {
                  "fixed": "5.15.209"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.16.0"
                },
                {
                  "fixed": "6.1.175"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.2.0"
                },
                {
                  "fixed": "6.6.135"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.7.0"
                },
                {
                  "fixed": "6.12.14"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.13.0"
                },
                {
                  "fixed": "6.13.3"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21739.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:52.793269829Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/0a6895c03b1f439236e2d22b1a69ebfc1eb9d5ea",
        "https://git.kernel.org/stable/c/0c77c0d754fe83cb154715fcfec6c3faef94f207",
        "https://git.kernel.org/stable/c/0dc539b888fb5f56b6eeddd95433eab557d4b0c1",
        "https://git.kernel.org/stable/c/9c185beae09a3eb85f54777edafa227f7e03075d",
        "https://git.kernel.org/stable/c/d06eb2620d3bf16056b8b7ea3744dbb5e30512f4",
        "https://git.kernel.org/stable/c/f8fb2403ddebb5eea0033d90d9daae4c88749ada",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/21xxx/CVE-2025-21739.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-21739",
        "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
      ],
      "provider_metadata": {
        "cna_assigner": "Linux",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/21xxx/CVE-2025-21739.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-21739",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 521526,
  "published_at": "2025-02-27T02:12:14.581+00:00"
}