{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2024-26807",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2024-26807"
  ],
  "published": "2024-04-04T08:23:56Z",
  "summary": "spi: cadence-qspi: fix pointer reference in runtime PM hooks",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nBoth cadence-quadspi ->runtime_suspend() and ->runtime_resume()\nimplementations start with:\n\n\tstruct cqspi_st *cqspi = dev_get_drvdata(dev);\n\tstruct spi_controller *host = dev_get_drvdata(dev);\n\nThis obviously cannot be correct, unless \"struct cqspi_st\" is the\nfirst member of \" struct spi_controller\", or the other way around, but\nit is not the case. \"struct spi_controller\" is allocated by\ndevm_spi_alloc_host(), which allocates an extra amount of memory for\nprivate data, used to store \"struct cqspi_st\".\n\nThe ->probe() function of the cadence-quadspi driver then sets the\ndevice drvdata to store the address of the \"struct cqspi_st\"\nstructure. Therefore:\n\n\tstruct cqspi_st *cqspi = dev_get_drvdata(dev);\n\nis correct, but:\n\n\tstruct spi_controller *host = dev_get_drvdata(dev);\n\nis not, as it makes \"host\" point not to a \"struct spi_controller\" but\nto the same \"struct cqspi_st\" structure as above.\n\nThis obviously leads to bad things (memory corruption, kernel crashes)\ndirectly during ->probe(), as ->probe() enables the device using PM\nruntime, leading the ->runtime_resume() hook being called, which in\nturns calls spi_controller_resume() with the wrong pointer.\n\nThis has at least been reported [0] to cause a kernel crash, but the\nexact behavior will depend on the memory contents.\n\n[0] https://lore.kernel.org/all/20240226121803.5a7r5wkpbbowcxgx@dhruva/\n\nThis issue potentially affects all platforms that are currently using\nthe cadence-quadspi driver.",
  "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.140",
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2024-26807"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/2c914aac9522f6e93822c18dff233d3e92399c81"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/03f1573c9587029730ca68503f5062105b122f61"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/34e1d5c4407c78de0e3473e1fbf8fb74dbe66d03"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/32ce3bb57b6b402de2aec1012511e7ac4e7449dc"
    }
  ],
  "database_specific": {
    "source": "https://git.kernel.org/pub/scm/linux/security/vulns.git",
    "upstream_modified": "2026-08-05T11:52:36Z",
    "severity": {
      "source": "kernel CNA",
      "cvss_v3_score": 7.8,
      "cvss_v3_severity": "High",
      "scenario": "AV:L - The vulnerable code is the runtime-PM hook of an on-SoC Cadence QSPI controller driver, reached through local flash I/O (MTD/mtdblock access driving `cqspi_exec_mem_op()` \u2192 `pm_runtime_resume_and_get()`) or the autosuspend timer. There is no network or remote-peer input path into this driver.\nAC:L - The wrong pointer is passed unconditionally on every suspend and resume, so the corrupting code path executes deterministically at probe time and on each runtime-PM transition; no race, timing window, or uncontrolled precondition needs to be won.\nPR:L - Any unprivileged local process can drive the cycle by touching a file on the flash-backed filesystem and then idling for the 2-second autosuspend timeout; no capability, CAP_SYS_ADMIN, or device-node ownership check exists anywhere along `cqspi_exec_mem_op()` \u2192 runtime PM \u2192 `cqspi_suspend()/cqspi_resume()`.\nUI:N - Autosuspend/resume transitions occur automatically from normal device activity and the 2 s idle timer, and the corruption already happens during probe; no victim action of any kind is required.\nS:U - The corruption is confined to kernel slab memory and the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - This is a type confusion in which `struct cqspi_st` is treated as `struct spi_controller`, causing reads and writes at offsets (`bus_lock_mutex` ~930B, `queued`, `kworker`) that fall into `f_pdata` or past the end of the `devm_spi_alloc_host()` allocation; such heap corruption with a groomable adjacent object can be leveraged into an arbitrary-read primitive.\nI:H - Type confusion with out-of-bounds writes \u2014 `ctlr->flags |=`, the mutex owner word, and `list_add_tail()` on an uninitialised `wait_list` in the mutex slowpath \u2014 plus `kthread_queue_work()` on a garbage `ctlr->kworker` pointer, gives write and control-flow corruption primitives rather than a benign fault.\nA:H - The upstream fix and the linked bug report document kernel crashes and memory corruption during probe; `mutex_lock()` on uninitialised memory can also hang the task indefinitely, and the path can be re-triggered repeatedly by an unprivileged user."
    }
  }
}
