From d36896fb3ad652895c1f8ccfc5b92420a14e8361 Mon Sep 17 00:00:00 2001 From: sudarsan N Date: Fri, 8 Aug 2025 15:20:54 +0530 Subject: [PATCH] spi: rtio: null pointer dereference in spi_rtio_transceive Check if cqe is NULL before accessing cqe->result in spi_rtio_transceive(). Prevents possible null pointer dereference from rtio_cqe_consume() return value. CID: 516229 Fixes: #90547 Signed-off-by: sudarsan N --- drivers/spi/spi_rtio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi_rtio.c b/drivers/spi/spi_rtio.c index 1b6a83ad01b3b..7a26727e66f8a 100644 --- a/drivers/spi/spi_rtio.c +++ b/drivers/spi/spi_rtio.c @@ -427,6 +427,11 @@ int spi_rtio_transceive(struct spi_rtio *ctx, while (ret > 0) { cqe = rtio_cqe_consume(ctx->r); + if (cqe == NULL) { + err = -EIO; + break; + } + if (cqe->result < 0) { err = cqe->result; }