FAILED: patch "[PATCH] accel/ivpu: Validate full buffer range in ivpu_to_cpu_addr" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 3837c3f29fbc3b8c12bebf5c62741e2befe3482a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026091646-nutmeg-dill-a3d1@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3837c3f29fbc3b8c12bebf5c62741e2befe3482a Mon Sep 17 00:00:00 2001
From: Magdalena Schulfer <[email protected]>
Date: Tue, 1 Sep 2026 14:57:47 +0200
Subject: [PATCH] accel/ivpu: Validate full buffer range in ivpu_to_cpu_addr
Add a size parameter to ivpu_to_cpu_addr() and validate that the whole [vpu_addr, vpu_addr + size) range stays within the BO.
drivers/accel/ivpu/ivpu_gem.h +11 -3
@@ -87,15 +87,23 @@ static inline bool ivpu_bo_is_resident(struct ivpu_bo *bo)return !!bo->base.pages; } -static inline void *ivpu_to_cpu_addr (struct ivpu_bo *bo,u32 vpu_addr) +static inline void *ivpu_to_cpu_addr (struct ivpu_bo *bo,u64 vpu_addr,u64 size) { +u64 bo_size =ivpu_bo_size (bo); +u64 offset; +if (vpu_addr < bo->vpu_addr)return NULL ; -if (vpu_addr >= (bo->vpu_addr +ivpu_bo_size (bo))) +if (size > bo_size)return NULL ; -return ivpu_bo_vaddr (bo) + (vpu_addr - bo->vpu_addr); + offset = vpu_addr - bo->vpu_addr; + +if (offset > bo_size - size) +return NULL ; + +return ivpu_bo_vaddr (bo) + offset; }static inline u32 cpu_to_vpu_addr (struct ivpu_bo *bo,void *cpu_addr)
drivers/accel/ivpu/ivpu_ipc.c +4 -3
@@ -79,7 +79,7 @@ ivpu_ipc_tx_prepare(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,return -ENOMEM ; } - tx_buf =ivpu_to_cpu_addr (ipc->mem_tx, tx_buf_vpu_addr); + tx_buf =ivpu_to_cpu_addr (ipc->mem_tx, tx_buf_vpu_addr,sizeof (*tx_buf));if (drm_WARN_ON (&vdev->drm, !tx_buf)) {gen_pool_free (ipc->mm_tx, tx_buf_vpu_addr,sizeof (*tx_buf));return -EIO ;
@@ -420,7 +420,7 @@ void ivpu_ipc_irq_handler(struct ivpu_device *vdev)return ; } - ipc_hdr =ivpu_to_cpu_addr (ipc->mem_rx, vpu_addr); + ipc_hdr =ivpu_to_cpu_addr (ipc->mem_rx, vpu_addr,sizeof (*ipc_hdr));if (!ipc_hdr) {ivpu_warn_ratelimited (vdev,"IPC msg 0x%x out of range\n" , vpu_addr);continue ;
@@ -429,7 +429,8 @@ void ivpu_ipc_irq_handler(struct ivpu_device *vdev) jsm_msg =NULL ;if (ipc_hdr->channel !=IVPU_IPC_CHAN_BOOT_MSG ) { - jsm_msg =ivpu_to_cpu_addr (ipc->mem_rx, ipc_hdr->data_addr); + jsm_msg =ivpu_to_cpu_addr (ipc->mem_rx, ipc_hdr->data_addr, +sizeof (*jsm_msg));if (!jsm_msg) {ivpu_warn_ratelimited (vdev,"JSM msg 0x%x out of range\n" , ipc_hdr->data_addr);