All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kishore Batta" <kishore.batta@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 4/7] bus: mhi: Add QDU100 Sahara variant and firmware fallback
Date: Mon, 12 Oct 2026 18:29:57 +0000	[thread overview]
Message-ID: <sashiko-outbox-168540@kernel.org> (raw)
In-Reply-To: <20261012-sahara_protocol_new_v2-v8-4-e12939d229a1@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mhi: sahara: concurrent workqueues corrupt shared tx[0] DMA buffer
--

commit f8c1fedf3c26d1f3f5b6996e23406ceb42b03572
Author: Kishore Batta <kishore.batta@oss.qualcomm.com>

bus: mhi: Add QDU100 Sahara variant and firmware fallback

This commit extends the Sahara driver to recognize QDU100 devices on the
SAHARA MHI channel and associates it with the QDU100 firmware folder. It also
adds a firmware lookup fallback to allow images to be provisioned by the
platform if they do not have an explicit entry in the device's firmware table.

> diff --git a/drivers/bus/mhi/host/clients/sahara/sahara.c b/drivers/bus/mhi/host/clients/sahara/sahara.c
> index 74bf57f02873e..4baa47d0b94e3 100644
> --- a/drivers/bus/mhi/host/clients/sahara/sahara.c
> +++ b/drivers/bus/mhi/host/clients/sahara/sahara.c

[ ... ]

> @@ -870,8 +891,10 @@ static void sahara_mhi_dl_xfer_cb(struct mhi_device *mhi_dev, struct mhi_result
>  
>  static const struct mhi_device_id sahara_mhi_match_table[] = {
>  	{ .chan = "QAIC_SAHARA", },
> +	{ .chan = "SAHARA", },

[Severity: High]
Does this code have a data race leading to DMA ring corruption?

During a streaming transfer, read_data_work repeatedly uses context->tx[0]
to stream firmware data:

drivers/bus/mhi/host/clients/sahara/sahara.c:read_data_helper() {
    ...
	memcpy(context->tx[buf_index],
	       &context->firmware->data[context->read_data_offset],
	       pkt_data_len);
    ...
}

If the endpoint concurrently sends an asynchronous command like HELLO,
END_OF_IMAGE, or CMD_READY, fw_work is scheduled and will overwrite tx[0]:

drivers/bus/mhi/host/clients/sahara/sahara.c:sahara_hello() {
    ...
	context->tx[0]->cmd = cpu_to_le32(SAHARA_HELLO_RESP_CMD);
	context->tx[0]->length = cpu_to_le32(SAHARA_HELLO_LENGTH);
    ...
}

Since read_data_work and fw_work could modify and queue the same TX buffer
at the same time, is it possible for tx[0] to be overwritten and enqueued
while it is already mapped and active for read_data_work?

An untrusted or misbehaving MHI endpoint could trigger this by sending an
unexpected packet during streaming.

>  	{},
>  };
> +MODULE_DEVICE_TABLE(mhi, sahara_mhi_match_table);
>  
>  static struct mhi_driver sahara_mhi_driver = {
>  	.id_table = sahara_mhi_match_table,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012-sahara_protocol_new_v2-v8-0-e12939d229a1@oss.qualcomm.com?part=4

  reply	other threads:[~2026-10-12 18:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 18:17 [PATCH v8 0/7] Qualcomm Sahara protocol enhancements Kishore Batta
2026-10-12 18:17 ` [PATCH v8 1/7] Add documentation for Sahara protocol Kishore Batta
2026-10-12 18:24   ` sashiko-bot
2026-10-12 18:18 ` [PATCH v8 2/7] bus: mhi: Move Sahara protocol driver under MHI host client drivers Kishore Batta
2026-10-12 18:27   ` sashiko-bot
2026-10-12 20:43   ` Uwe Kleine-König
2026-10-13  7:27     ` Kishore Batta
2026-10-12 21:35   ` Trilok Soni
2026-10-13  7:30     ` Kishore Batta
2026-10-12 18:18 ` [PATCH v8 3/7] bus: mhi: Centralize Sahara firmware image table selection at probe time Kishore Batta
2026-10-12 18:29   ` sashiko-bot
2026-10-12 18:18 ` [PATCH v8 4/7] bus: mhi: Add QDU100 Sahara variant and firmware fallback Kishore Batta
2026-10-12 18:29   ` sashiko-bot [this message]
2026-10-12 18:18 ` [PATCH v8 5/7] bus: mhi: Load DDR training data using device serial number Kishore Batta
2026-10-12 18:18 ` [PATCH v8 6/7] bus: mhi: Capture DDR training data via command mode Kishore Batta
2026-10-12 18:27   ` sashiko-bot
2026-10-12 18:18 ` [PATCH v8 7/7] bus: mhi: Expose DDR training data via controller sysfs Kishore Batta
2026-10-12 18:32   ` 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-168540@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.