[PATCH 1/2] memory: brcmstb_dpfe: Fix out-of-bounds access due to DCPU offset
Florian Fainelli
florian.fainelli at broadcom.com
Wed Aug 26 16:07:06 PDT 2026
On 8/26/26 13:14, Danesh Petigara wrote:
> From: Justin Chen <justin.chen at broadcom.com>
>
> On API v1/v2 boards, the DCPU coprocessor can steer kernel readl_relaxed()
> and writel_relaxed() to any address within 256 MB of the ioremapped DPFE
> dmem or regs base. The DCPU firmware provides a 28-bit offset which the
> driver adds to the ioremap base without any bounds checking in
> get_msg_ptr().
>
> This allows a compromised DCPU firmware to trick the host kernel into
> reading or writing arbitrary memory-mapped I/O registers in vmalloc
> space. When combined with a root-writable sysfs file like dpfe_refresh,
> it provides an arbitrary MMIO write primitive. Similarly, world-readable
> sysfs files can be used to leak other devices' register contents.
>
> Fix this by recording the resource_size() of the dmem and regs ioremaps
> at probe time, and rejecting any offset that, along with the largest
> field accessed (DRAM_VENDOR_ERROR + sizeof(u32)), exceeds the recorded
> mapping size.
>
> Fixes: fee5f1ef6cf7 ("memory: brcmstb: dpfe: support new way of passing data from the DCPU")
> Cc: stable at vger.kernel.org
> Signed-off-by: Justin Chen <justin.chen at broadcom.com>
> Assisted-by: Gemini:gemini-3.1-pro-preview cursor
> Signed-off-by: Danesh Petigara <danesh.petigara at broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli at broadcom.com>
--
Florian
More information about the linux-arm-kernel
mailing list