{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2025-21870",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2025-21870"
  ],
  "published": "2025-03-27T13:38:45Z",
  "summary": "ASoC: SOF: ipc4-topology: Harden loops for looking up ALH copiers",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nASoC: SOF: ipc4-topology: Harden loops for looking up ALH copiers\n\nOther, non DAI copier widgets could have the same  stream name (sname) as\nthe ALH copier and in that case the copier->data is NULL, no alh_data is\nattached, which could lead to NULL pointer dereference.\nWe could check for this NULL pointer in sof_ipc4_prepare_copier_module()\nand avoid the crash, but a similar loop in sof_ipc4_widget_setup_comp_dai()\nwill miscalculate the ALH device count, causing broken audio.\n\nThe correct fix is to harden the matching logic by making sure that the\n1. widget is a DAI widget - so dai = w->private is valid\n2. the dai (and thus the copier) is ALH copier",
  "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": null,
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-21870"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/87c8768a96092ce75cd47fe076db5080db7ac515"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/93c6c2e5801aab09ef1ef99f248f3cd323c3f152"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/6fd60136d256b3b948333ebdb3835f41a95ab7ef"
    }
  ],
  "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 - The vulnerable code is reached only through the local ALSA PCM character device (`/dev/snd/pcmC*D*`) via `SNDRV_PCM_IOCTL_HW_PARAMS`, which flows into `sof_pcm_hw_params()` \u2192 `sof_prepare_widgets_in_path()` \u2192 `sof_ipc4_prepare_copier_module()`. There is no network or remote-peer input on this path.\nAC:L - On an affected system (Intel SoundWire/ALH platform whose topology has a non-DAI widget sharing an `sname` with an ALH copier), the attacker simply opens the PCM device and issues hw_params \u2014 the faulty widget-matching loop runs deterministically every time, with no race to win and no memory layout to guess.\nPR:L - Only access to the sound PCM device node is required, which any logged-in desktop user gets via logind ACLs and any `audio`-group member gets on servers/embedded systems; no capability check exists anywhere along the hw_params \u2192 widget-prepare path.\nUI:N - The attacker performs the entire sequence themselves by opening the PCM device and calling hw_params; no victim action, mount, or file-open by another user is needed.\nS:U - The type confusion and heap corruption occur in kernel memory within the same security authority as the attacking local user; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The type confusion causes `dai->private` to be read from a mismatched struct and dereferenced as `struct sof_ipc4_copier *`, disclosing arbitrary kernel heap contents, and the inflated `config_length` makes the `memcpy()` at ipc4-topology.c:2211 read past the 136-byte blob allocation into the IPC payload.\nI:H - This is a type confusion (`w->private` treated as `struct snd_sof_dai` when it is not), and the unbounded `blob->alh_cfg.mapping[i++]` loop can write past the fixed 16-entry array in a kmalloc-192 object, giving a heap out-of-bounds write that is leverageable for control-flow corruption.\nA:H - The commit explicitly documents a NULL/wild pointer dereference causing a kernel oops, and the miscounted `device_count` additionally corrupts the ALH blob and yields `GENMASK(-1, 0)` via a zero `step` \u2014 any of which panics the kernel and can be re-triggered at will."
    }
  }
}
