Devicetree
 help / color / mirror / Atom feed
From: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
To: sashiko-reviews@lists.linux.dev
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v2 2/2] net: wwan: qcom_bam_dmux: Assign restricted DMA pool to remote processor
Date: Thu, 1 Oct 2026 20:18:18 +0530	[thread overview]
Message-ID: <b5b4dc98-7c46-4482-ac6a-dc3f042d3947@oss.qualcomm.com> (raw)
In-Reply-To: <20260921030315.BDF9B1F000FF@smtp.kernel.org>


On 21-09-2026 08:33 am, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] wwan: qcom_bam_dmux: probe error path reclaims DMA pool before disabling IRQ
> --
>
> commit 4ad4e0793e663284df130f5d11d5a4f0bb1754cc
> Author: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
>
> net: wwan: qcom_bam_dmux: Assign restricted DMA pool to remote processor
>
> This commit introduces restricted DMA pool support to the BAM-DMUX WWAN
> network driver for Qualcomm SoCs. It assigns the pool to local and remote
> execution environments during probe and reclaims it on driver removal
> or probe failure.
>
>> diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c
>> index cc6ace8d64371..c81e668d4e961 100644
>> --- a/drivers/net/wwan/qcom_bam_dmux.c
>> +++ b/drivers/net/wwan/qcom_bam_dmux.c
> [ ... ]
>
>> @@ -845,6 +938,7 @@ static int bam_dmux_probe(struct platform_device *pdev)
>>   err_disable_pm:
>>   	pm_runtime_disable(dev);
>>   	pm_runtime_dont_use_autosuspend(dev);
>> +	bam_dmux_reclaim_dma_pool(dmux);
>>   	return ret;
>>   }
> [Severity: High]
> Could reclaiming the DMA pool here lead to an XPU violation and resource
> leak if an interrupt fires concurrently?
>
> If probe fails late (for example, if irq_get_irqchip_state() returns an
> error), the code jumps to the err_disable_pm label. At this point, the
> pc_irq has already been requested via devm_request_threaded_irq() and
> is active.
>
> If the remote processor triggers this interrupt, the threaded handler
> (bam_dmux_pc_irq) could be executing bam_dmux_power_on() while we are
> calling bam_dmux_reclaim_dma_pool().
>
> This concurrent execution would cause the DMA pool to be reclaimed
> while the BAM DMA controller is actively using it, resulting in a system
> crash. Furthermore, when devres eventually frees the IRQ, any DMA
> channels or mappings allocated by the racing handler would leak because
> bam_dmux_power_off() is not called in this error path.

Makes sense. I plan to reuse bam_dmux_remove() for this, which disables the IRQ
and releases the DMA channels, mappings and any registered netdevs before
reclaiming the pool, in the same order as a regular remove. I will test
this and include it in the next revision.

Thanks,
Vishnu


  reply	other threads:[~2026-10-01 14:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  3:02 [PATCH net-next v2 0/2] net: wwan: qcom_bam_dmux: Add restricted DMA pool support Vishnu Santhosh
2026-09-20  3:02 ` [PATCH net-next v2 1/2] dt-bindings: net: qcom,bam-dmux: Add memory-region and qcom,vmid properties Vishnu Santhosh
2026-09-20 10:36   ` Krzysztof Kozlowski
2026-09-21  8:16     ` Loic Poulain
2026-10-01  5:58       ` Vishnu Santhosh
2026-09-21 11:04     ` Vishnu Santhosh
2026-09-21  3:48   ` netdev-bot+sashiko
2026-10-01 15:41     ` Vishnu Santhosh
2026-09-20  3:02 ` [PATCH net-next v2 2/2] net: wwan: qcom_bam_dmux: Assign restricted DMA pool to remote processor Vishnu Santhosh
2026-09-21  3:03   ` sashiko-bot
2026-10-01 14:48     ` Vishnu Santhosh [this message]
2026-10-01 14:49     ` Vishnu Santhosh
2026-09-21  3:48   ` netdev-bot+sashiko
2026-10-01 15:35     ` Vishnu Santhosh
2026-09-21  7:59   ` Loic Poulain
2026-09-21 11:13     ` Vishnu Santhosh
2026-09-28 10:32 ` [PATCH net-next v2 0/2] net: wwan: qcom_bam_dmux: Add restricted DMA pool support Vishnu Santhosh
2026-09-29  8:14   ` Stephan Gerhold
2026-09-29 14:58     ` Vishnu Santhosh

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=b5b4dc98-7c46-4482-ac6a-dc3f042d3947@oss.qualcomm.com \
    --to=vishnu.santhosh@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox