From: sashiko-bot@kernel.org
To: "Youssef Samir" <youssef.abdulrahman@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/5] accel/qaic: Add <linux/device-id/mhi.h> to qaic_drv.c
Date: Mon, 27 Jul 2026 17:44:45 +0000 [thread overview]
Message-ID: <20260727174445.BB8821F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260727173326.2219191-3-youssef.abdulrahman@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing teardown of registered drivers (Sahara, RAS, Timesync) when module initialization fails in qaic_init().
- [High] The return value of init_srcu_struct() is ignored, which can cause a kernel panic if the per-CPU memory allocation fails.
--
--- Patch [2]: [PATCH 2/5] accel/qaic: Add <linux/device-id/mhi.h> to qaic_drv.c ---
commit 659a1f299787dffbb6e5f80693c0d8c629fc6ab4
Author: Youssef Samir <youssef.abdulrahman@oss.qualcomm.com>
accel/qaic: Add <linux/device-id/mhi.h> to qaic_drv.c
qaic_drv.c uses mhi_device_id implicitly. Include <linux/device-id/mhi.h>.
> diff --git a/drivers/accel/qaic/qaic_drv.c b/drivers/accel/qaic/qaic_drv.c
> index 0acf6cdd44f81..c1bb6db78d129 100644
> --- a/drivers/accel/qaic/qaic_drv.c
> +++ b/drivers/accel/qaic/qaic_drv.c
> @@ -4,6 +4,7 @@
> /* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */
>
> #include <linux/delay.h>
> +#include <linux/device-id/mhi.h>
[Severity: High]
This is a pre-existing issue, but does qaic_init() leave dangling references if
module initialization fails?
If qaic_ssr_register() fails, the code jumps to the free_bootlog label:
drivers/accel/qaic/qaic_drv.c:qaic_init() {
...
free_bootlog:
qaic_bootlog_unregister();
free_mhi:
mhi_driver_unregister(&qaic_mhi_driver);
free_pci:
pci_unregister_driver(&qaic_pci_driver);
return ret;
}
This error path unregisters the bootlog, MHI driver, and PCI driver, but skips
unregistering the sahara, ras, and timesync components that were initialized
earlier.
Could the MHI core eventually access this freed memory, leading to a
use-after-free panic?
[Severity: High]
This is a pre-existing issue, but can the ignored return value of
init_srcu_struct() in qaic_open() lead to a panic?
drivers/accel/qaic/qaic_drv.c:qaic_open() {
...
init_srcu_struct(&usr->qddev_lock);
...
}
If it fails to allocate required internal structures (returning e.g. -ENOMEM),
the srcu_sup pointer in usr->qddev_lock is left as NULL. If the subsequent
mutex_lock_interruptible() fails, the code jumps to cleanup_usr and calls:
drivers/accel/qaic/qaic_drv.c:qaic_open() {
...
cleanup_srcu_struct(&usr->qddev_lock);
...
}
Will cleanup_srcu_struct() blindly dereference the NULL srcu_sup pointer,
causing a crash?
> #include <linux/dma-mapping.h>
> #include <linux/idr.h>
> #include <linux/interrupt.h>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260727173326.2219191-1-youssef.abdulrahman@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-07-27 17:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 17:33 [PATCH 0/5] accel/qaic: Add missing <linux/device-id/mhi.h> to .c files Youssef Samir
2026-07-27 17:33 ` [PATCH 1/5] accel/qaic: Add missing <linux/device-id/mhi.h> to sahara and timesync Youssef Samir
2026-07-27 17:33 ` [PATCH 2/5] accel/qaic: Add <linux/device-id/mhi.h> to qaic_drv.c Youssef Samir
2026-07-27 17:44 ` sashiko-bot [this message]
2026-07-27 17:33 ` [PATCH 3/5] accel/qaic: Add <linux/device-id/mhi.h> to qaic_debugfs.c Youssef Samir
2026-07-27 17:33 ` [PATCH 4/5] accel/qaic: Add <linux/device-id/mhi.h> to qaic_ras.c Youssef Samir
2026-07-27 17:33 ` [PATCH 5/5] accel/qaic: Add <linux/device-id/mhi.h> to qaic_ssr.c Youssef Samir
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260727174445.BB8821F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=youssef.abdulrahman@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.