Re: [PATCH] staging: vme_user: fix list iterator tracking and prune dead validations
From: Dan Carpenter
Date: Thu Oct 15 2026 - 05:22:21 EST
On Sun, Oct 04, 2026 at 11:29:11PM -0500, Marinela Tatiana Selseth wrote:
> Automated static analysis runs using 'make coccicheck' uncovered
> multiple critical logic and validation flaws inside the VME subsystem.
> The file drivers/staging/vme_user/vme.c contained repetitive
> unreachable checks testing list iterator pointers for NULL (such as if
> (!dma_ctrlr) and if (!lm)) immediately following 'list_for_each_entry'
> loop boundaries.
> Because of internal pointer arithmetic designs, these loop variables
> are mathematically guaranteed to never evaluate to NULL during loop
> processing.
>
> Worse, if memory allocations failed for the corresponding structure
> images, the error cleanup paths ('err_alloc:') attempted to acquire
> spinlocks or mutex blocks using those same loop iterators. Since the
> traversal was already complete, these pointers held out-of-bounds,
> scrambled memory offsets, exposing the kernel to critical Null Pointer
> Dereference panics.
AI write too long wordy commit messages. This second paragraph is
also wrong factually.
1. The check:
/* Check to see if we found a resource */
if (!allocated_image) {
ensures that we hit a break and the pointer is valid.
2. It wouldn't be a NULL pointer dereference, it would be an
invalid pointer.
>
> Clean up this driver architecture by removing the unreachable loop
> checks entirely, dropping stale, misleading warning statements, and
> routing the post-loop lock cleanups cleanly through verified
> allocation tracking pointer references.
>
> Assisted-by: Gemini
> Signed-off-by: Marinela Tatiana Selseth <marinela.selseth@xxxxxxxxxxxxxxxxxx>
> ---
If the bug were real as stated in the commit message then we would
need a Fixes tag.
regards,
dan carpenter