{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2025-21924",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2025-21924"
  ],
  "published": "2025-04-01T15:40:16Z",
  "summary": "net: hns3: make sure ptp clock is unregister and freed if hclge_ptp_get_cycle returns an error",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nnet: hns3: make sure ptp clock is unregister and freed if hclge_ptp_get_cycle returns an error\n\nDuring the initialization of ptp, hclge_ptp_get_cycle might return an error\nand returned directly without unregister clock and free it. To avoid that,\ncall hclge_ptp_destroy_clock to unregist and free clock if\nhclge_ptp_get_cycle failed.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "Raspberry Pi OS:12",
        "name": "linux"
      },
      "versions": [
        "1:6.1.47-1+rpt4"
      ],
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-2712",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v6",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7l",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v8",
            "binary_version": "1:6.1.47-1+rpt4"
          }
        ]
      },
      "database_specific": {
        "per_version": {
          "1:6.1.47-1+rpt4": {
            "linux_commit": "655fc658a15ae7a6f37103754adb39ba52a9a14e",
            "upstream_version": "6.1.47",
            "assessment": "commit ancestry (strak rule)",
            "upstream_fixed": "6.1.131",
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-21924"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/b7d8d4529984e2d4a72a6d552fb886233e8e83cb"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/33244e98aa9503585e585335fe2ceb4492630949"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/2c04e507f3a5c5dc6e2b9ab37d8cdedee1ef1a37"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/9cfc43c0e6e6a31122b4008d763a2960c206aa2d"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/21dba813d9821687a7f9aff576798ba21a859a32"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/b7365eab39831487a84e63a9638209b68dc54008"
    }
  ],
  "database_specific": {
    "source": "https://git.kernel.org/pub/scm/linux/security/vulns.git",
    "upstream_modified": "2026-08-05T12:19:11Z",
    "severity": {
      "source": "kernel CNA",
      "cvss_v3_score": 7.8,
      "cvss_v3_severity": "High",
      "scenario": "AV:L - Exploitation requires local access to the stale PTP clock left behind \u2014 reading world-readable `/sys/class/ptp/ptpN/clock_name` or issuing ioctls/clock_adjtime on `/dev/ptpN`; no network traffic reaches this code.\nAC:L - On an affected platform the dangling `ptp_clock` is created deterministically on every failed probe/reset with no race to win and no memory-layout precondition, so the attacker can dereference the freed `ptp_clock_info` at will.\nPR:L - The PTP sysfs attributes that dereference the freed `ptp->info` (`clock_name`, `max_adjustment`, `n_*`) are mode 0444, so any unprivileged local account can trigger the use-after-free; `/dev/ptpN` widens this further where PTP daemons/containers are granted access.\nUI:N - The dangling registration is created by driver probe or device reset at boot; the attacker acts alone and needs no victim to perform any action.\nS:U - The freed devm slab object and the PTP core both reside in the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - Use-after-free of the `hclge_ptp` object leaks reallocated slab contents through `sysfs_emit(\"%s\", ptp->info->name)`, and `hclge_ptp_gettimex()` returns `readl()` from an `io_base` taken from the freed object, yielding an attacker-directed read primitive.\nI:H - `hclge_ptp_settime()`/`adjtime()`/`adjfine()` perform `writel(attacker_value, hdev->ptp->io_base + off)` with both value and address sourced from the freed allocation, giving an arbitrary-write primitive once the slab is groomed, plus dangling function pointers in `ptp_clock_info` for control-flow hijack.\nA:H - Any access to the orphaned PTP clock dereferences freed memory (and unmapped MMIO after `pcim_iounmap`), reliably producing an oops or panic; the reset path additionally leaves `cycle.den == 0` reachable by `div_u64_rem()`."
    }
  }
}
