From: sashiko-bot@kernel.org
To: "Kishore Batta" <kishore.batta@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v9 5/7] bus: mhi: Load DDR training data using device serial number
Date: Tue, 13 Oct 2026 09:00:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-169295@kernel.org> (raw)
In-Reply-To: <20261013-sahara_protocol_new_v2-v9-5-dc9f24357c4a@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mhi/sahara: UAF due to missing cancel_work_sync(read_data_work)
--
commit db3ce9303033a085ebf1250fe283d48253b7c50d
Author: Kishore Batta <kishore.batta@oss.qualcomm.com>
bus: mhi: Load DDR training data using device serial number
Extend the firmware loading logic for the DDR training image to first
attempt loading a per-device image dervied from the device serial number.
If the serial-specific image is not present, fall back to the existing
default image, preserving current behavior. This allows reuse of previously
generated DDR training data when available.
> diff --git a/drivers/bus/mhi/host/clients/sahara/sahara.c b/drivers/bus/mhi/host/clients/sahara/sahara.c
> index a4b3ef197b303..62b9c72e82680 100644
> --- a/drivers/bus/mhi/host/clients/sahara/sahara.c
> +++ b/drivers/bus/mhi/host/clients/sahara/sahara.c
> @@ -58,6 +58,7 @@
> #define SAHARA_RESET_LENGTH 0x8
> #define SAHARA_MEM_DEBUG64_LENGTH 0x18
> #define SAHARA_MEM_READ64_LENGTH 0x18
> +#define SAHARA_DDR_TRAINING_IMG_ID 34
>
> struct sahara_packet {
> __le32 cmd;
[ ... ]
[Severity: High]
Does driver teardown miss cancelling the read_data_work?
Looking at sahara_mhi_remove():
drivers/bus/mhi/host/clients/sahara/sahara.c:sahara_mhi_remove() {
...
cancel_work_sync(&context->fw_work);
cancel_work_sync(&context->dump_work);
vfree(context->mem_dump);
...
}
If the MHI device is unbound or hot-unplugged while a Sahara READ_DATA
streaming operation is active, read_data_work can be scheduled or already
running.
Since sahara_mhi_remove() omits cancelling read_data_work, when remove()
returns, the devres framework will automatically free the context structure
allocated via devm_kzalloc().
Can the uncancelled read_data_work then dereference the freed context
structure and cause a use-after-free?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-sahara_protocol_new_v2-v9-0-dc9f24357c4a@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-10-13 9:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 8:45 [PATCH v9 0/7] Qualcomm Sahara protocol enhancements Kishore Batta
2026-10-13 8:45 ` [PATCH v9 1/7] Add documentation for Sahara protocol Kishore Batta
2026-10-13 8:51 ` sashiko-bot
2026-10-13 8:45 ` [PATCH v9 2/7] bus: mhi: Move Sahara protocol driver under MHI host client drivers Kishore Batta
2026-10-13 9:00 ` sashiko-bot
2026-10-13 8:45 ` [PATCH v9 3/7] bus: mhi: Centralize Sahara firmware image table selection at probe time Kishore Batta
2026-10-13 8:45 ` [PATCH v9 4/7] bus: mhi: Add QDU100 Sahara variant and firmware fallback Kishore Batta
2026-10-13 9:01 ` sashiko-bot
2026-10-13 8:45 ` [PATCH v9 5/7] bus: mhi: Load DDR training data using device serial number Kishore Batta
2026-10-13 9:00 ` sashiko-bot [this message]
2026-10-13 8:45 ` [PATCH v9 6/7] bus: mhi: Capture DDR training data via command mode Kishore Batta
2026-10-13 8:59 ` sashiko-bot
2026-10-13 8:45 ` [PATCH v9 7/7] bus: mhi: Expose DDR training data via controller sysfs Kishore Batta
2026-10-13 8:58 ` sashiko-bot
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=sashiko-outbox-169295@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kishore.batta@oss.qualcomm.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.