Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>,
	<broonie@kernel.org>, <vkoul@kernel.org>,
	<akashast@codeaurora.org>, <dianders@chromium.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-spi@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] spi: geni-qcom: Fix incorrect free_irq() sequence
Date: Fri, 6 Sep 2024 14:47:22 +0800	[thread overview]
Message-ID: <2fd2b482-3d87-b95e-570a-10bee284d2da@huawei.com> (raw)
In-Reply-To: <cff36a59-6f4f-4ae9-b5b9-e6e1ae822e41@quicinc.com>



On 2024/9/6 12:27, Mukesh Kumar Savaliya wrote:
> Hi Jinjie,
> 
> On 9/6/2024 8:43 AM, Jinjie Ruan wrote:
>> In spi_geni_remove(), the IRQ will still remain and it's interrupt
>> handler
>> may use the dma channel after release dma channel and before free irq,
>> which is not secure, fix it.
>>
> What's the possibility of having irq if spi_geni_release_dma_chan(mas)
> is completed ? As such controller is already unregistered so transfer
> request can't come.

The irq is not freed, the IRQ can come and then it may enter the irq
handler with the registered one.

>> Fixes: b59c122484ec ("spi: spi-geni-qcom: Add support for GPI dma")
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> ---
>>   drivers/spi/spi-geni-qcom.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
>> index 37ef8c40b276..fc2819effe2d 100644
>> --- a/drivers/spi/spi-geni-qcom.c
>> +++ b/drivers/spi/spi-geni-qcom.c
>> @@ -1170,9 +1170,10 @@ static void spi_geni_remove(struct
>> platform_device *pdev)
>>       /* Unregister _before_ disabling pm_runtime() so we stop
>> transfers */
>>       spi_unregister_controller(spi);
>>   +    free_irq(mas->irq, spi);
>> +
>>       spi_geni_release_dma_chan(mas);
>>   -    free_irq(mas->irq, spi);
>>       pm_runtime_disable(&pdev->dev);
>>   }
>>   
> 

  reply	other threads:[~2024-09-06  6:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  3:13 [PATCH v2 0/2] spi: geni-qcom: Fix incorrect free_irq() sequence Jinjie Ruan
2024-09-06  3:13 ` [PATCH v2 1/2] " Jinjie Ruan
2024-09-06  4:27   ` Mukesh Kumar Savaliya
2024-09-06  6:47     ` Jinjie Ruan [this message]
2024-09-06 10:57       ` Mukesh Kumar Savaliya
2024-09-06  3:13 ` [PATCH v2 2/2] spi: spi-geni-qcom: Fix missing undo runtime PM changes at driver exit time Jinjie Ruan
2024-09-06  3:15   ` Dmitry Baryshkov
2024-09-06  3:31     ` Jinjie Ruan
2024-09-06  3:36       ` Dmitry Baryshkov
2024-09-06  3:40         ` Jinjie Ruan
2024-09-06  3:43           ` Dmitry Baryshkov
2024-09-06  3:50             ` Jinjie Ruan
2024-09-06  3:52               ` Dmitry Baryshkov
2024-09-06  4:01                 ` Jinjie Ruan
2024-09-06  4:03                   ` Dmitry Baryshkov
2024-09-06  6:50                     ` Jinjie Ruan

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=2fd2b482-3d87-b95e-570a-10bee284d2da@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=akashast@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=quic_msavaliy@quicinc.com \
    --cc=vkoul@kernel.org \
    /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