* [PATCH] media: venus: hfi: explicitly release IRQ during teardown
@ 2025-06-12 8:29 Jorge Ramirez-Ortiz
2025-06-16 11:56 ` Vikash Garodia
0 siblings, 1 reply; 8+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-06-12 8:29 UTC (permalink / raw)
To: jorge.ramirez, quic_vgarodia, quic_dikshita, bryan.odonoghue,
loic.poulain, mchehab, hans.verkuil
Cc: linux-media, linux-arm-msm, linux-kernel
Ensure the IRQ is released before dismantling the ISR handler and
clearing related pointers.
This prevents any possibility of the interrupt triggering after the
handler context has been invalidated.
Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
index b5f2ea879950..d9d62d965bcf 100644
--- a/drivers/media/platform/qcom/venus/hfi_venus.c
+++ b/drivers/media/platform/qcom/venus/hfi_venus.c
@@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
venus_interface_queues_release(hdev);
mutex_destroy(&hdev->lock);
kfree(hdev);
+ devm_free_irq(core->dev, core->irq, core);
core->ops = NULL;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] media: venus: hfi: explicitly release IRQ during teardown
2025-06-12 8:29 [PATCH] media: venus: hfi: explicitly release IRQ during teardown Jorge Ramirez-Ortiz
@ 2025-06-16 11:56 ` Vikash Garodia
2025-06-16 12:59 ` Jorge Ramirez
0 siblings, 1 reply; 8+ messages in thread
From: Vikash Garodia @ 2025-06-16 11:56 UTC (permalink / raw)
To: Jorge Ramirez-Ortiz, quic_dikshita, bryan.odonoghue, loic.poulain,
mchehab, hans.verkuil
Cc: linux-media, linux-arm-msm, linux-kernel
On 6/12/2025 1:59 PM, Jorge Ramirez-Ortiz wrote:
> Ensure the IRQ is released before dismantling the ISR handler and
> clearing related pointers.
>
> This prevents any possibility of the interrupt triggering after the
> handler context has been invalidated.
>
> Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
> drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> index b5f2ea879950..d9d62d965bcf 100644
> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> @@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
> venus_interface_queues_release(hdev);
> mutex_destroy(&hdev->lock);
> kfree(hdev);
> + devm_free_irq(core->dev, core->irq, core);
Could you please check and add the handling here [1] as well ?
[1]
https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/media/platform/qcom/venus/core.c#L427
Regards,
Vikash
> core->ops = NULL;
> }
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] media: venus: hfi: explicitly release IRQ during teardown
2025-06-16 11:56 ` Vikash Garodia
@ 2025-06-16 12:59 ` Jorge Ramirez
2025-06-16 14:44 ` Vikash Garodia
0 siblings, 1 reply; 8+ messages in thread
From: Jorge Ramirez @ 2025-06-16 12:59 UTC (permalink / raw)
To: Vikash Garodia
Cc: Jorge Ramirez-Ortiz, quic_dikshita, bryan.odonoghue, loic.poulain,
mchehab, hans.verkuil, linux-media, linux-arm-msm, linux-kernel
On 16/06/25 17:26:24, Vikash Garodia wrote:
>
> On 6/12/2025 1:59 PM, Jorge Ramirez-Ortiz wrote:
> > Ensure the IRQ is released before dismantling the ISR handler and
> > clearing related pointers.
> >
> > This prevents any possibility of the interrupt triggering after the
> > handler context has been invalidated.
> >
> > Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
> > Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> > ---
> > drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> > index b5f2ea879950..d9d62d965bcf 100644
> > --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> > +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> > @@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
> > venus_interface_queues_release(hdev);
> > mutex_destroy(&hdev->lock);
> > kfree(hdev);
> > + devm_free_irq(core->dev, core->irq, core);
> Could you please check and add the handling here [1] as well ?
>
> [1]
> https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/media/platform/qcom/venus/core.c#L427
hi Vikash, sorry I dont get your point - what do you mean?
>
> Regards,
> Vikash
> > core->ops = NULL;
> > }
> >
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] media: venus: hfi: explicitly release IRQ during teardown
2025-06-16 12:59 ` Jorge Ramirez
@ 2025-06-16 14:44 ` Vikash Garodia
2025-06-16 15:32 ` Jorge Ramirez
0 siblings, 1 reply; 8+ messages in thread
From: Vikash Garodia @ 2025-06-16 14:44 UTC (permalink / raw)
To: Jorge Ramirez
Cc: quic_dikshita, bryan.odonoghue, loic.poulain, mchehab,
hans.verkuil, linux-media, linux-arm-msm, linux-kernel
Hi Jorge,
On 6/16/2025 6:29 PM, Jorge Ramirez wrote:
> On 16/06/25 17:26:24, Vikash Garodia wrote:
>>
>> On 6/12/2025 1:59 PM, Jorge Ramirez-Ortiz wrote:
>>> Ensure the IRQ is released before dismantling the ISR handler and
>>> clearing related pointers.
>>>
>>> This prevents any possibility of the interrupt triggering after the
>>> handler context has been invalidated.
>>>
>>> Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
>>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
>>> ---
>>> drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
>>> index b5f2ea879950..d9d62d965bcf 100644
>>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
>>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
>>> @@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
>>> venus_interface_queues_release(hdev);
>>> mutex_destroy(&hdev->lock);
>>> kfree(hdev);
>>> + devm_free_irq(core->dev, core->irq, core);
>> Could you please check and add the handling here [1] as well ?
>>
>> [1]
>> https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/media/platform/qcom/venus/core.c#L427
>
> hi Vikash, sorry I dont get your point - what do you mean?
IRQ need to be freed even for error cases during venus_probe().
Regards,
Vikash
>
>>
>> Regards,
>> Vikash
>>> core->ops = NULL;
>>> }
>>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] media: venus: hfi: explicitly release IRQ during teardown
2025-06-16 14:44 ` Vikash Garodia
@ 2025-06-16 15:32 ` Jorge Ramirez
2025-06-18 7:07 ` Jorge Ramirez
0 siblings, 1 reply; 8+ messages in thread
From: Jorge Ramirez @ 2025-06-16 15:32 UTC (permalink / raw)
To: Vikash Garodia
Cc: Jorge Ramirez, quic_dikshita, bryan.odonoghue, loic.poulain,
mchehab, hans.verkuil, linux-media, linux-arm-msm, linux-kernel
On 16/06/25 20:14:36, Vikash Garodia wrote:
> Hi Jorge,
>
> On 6/16/2025 6:29 PM, Jorge Ramirez wrote:
> > On 16/06/25 17:26:24, Vikash Garodia wrote:
> >>
> >> On 6/12/2025 1:59 PM, Jorge Ramirez-Ortiz wrote:
> >>> Ensure the IRQ is released before dismantling the ISR handler and
> >>> clearing related pointers.
> >>>
> >>> This prevents any possibility of the interrupt triggering after the
> >>> handler context has been invalidated.
> >>>
> >>> Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
> >>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> >>> ---
> >>> drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
> >>> 1 file changed, 1 insertion(+)
> >>>
> >>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> >>> index b5f2ea879950..d9d62d965bcf 100644
> >>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> >>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> >>> @@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
> >>> venus_interface_queues_release(hdev);
> >>> mutex_destroy(&hdev->lock);
> >>> kfree(hdev);
> >>> + devm_free_irq(core->dev, core->irq, core);
> >> Could you please check and add the handling here [1] as well ?
> >>
> >> [1]
> >> https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/media/platform/qcom/venus/core.c#L427
> >
> > hi Vikash, sorry I dont get your point - what do you mean?
> IRQ need to be freed even for error cases during venus_probe().
>
but this is what the current patch does (venus_hfi_destroy is called at
the end of probe error handling as well).
> Regards,
> Vikash
> >
> >>
> >> Regards,
> >> Vikash
> >>> core->ops = NULL;
> >>> }
> >>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] media: venus: hfi: explicitly release IRQ during teardown
2025-06-16 15:32 ` Jorge Ramirez
@ 2025-06-18 7:07 ` Jorge Ramirez
2025-06-18 11:08 ` Bryan O'Donoghue
0 siblings, 1 reply; 8+ messages in thread
From: Jorge Ramirez @ 2025-06-18 7:07 UTC (permalink / raw)
To: Jorge Ramirez
Cc: Vikash Garodia, quic_dikshita, bryan.odonoghue, loic.poulain,
mchehab, hans.verkuil, linux-media, linux-arm-msm, linux-kernel
On 16/06/25 17:32:38, Jorge Ramirez wrote:
> On 16/06/25 20:14:36, Vikash Garodia wrote:
> > Hi Jorge,
> >
> > On 6/16/2025 6:29 PM, Jorge Ramirez wrote:
> > > On 16/06/25 17:26:24, Vikash Garodia wrote:
> > >>
> > >> On 6/12/2025 1:59 PM, Jorge Ramirez-Ortiz wrote:
> > >>> Ensure the IRQ is released before dismantling the ISR handler and
> > >>> clearing related pointers.
> > >>>
> > >>> This prevents any possibility of the interrupt triggering after the
> > >>> handler context has been invalidated.
> > >>>
> > >>> Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
> > >>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> > >>> ---
> > >>> drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
> > >>> 1 file changed, 1 insertion(+)
> > >>>
> > >>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> > >>> index b5f2ea879950..d9d62d965bcf 100644
> > >>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> > >>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> > >>> @@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
> > >>> venus_interface_queues_release(hdev);
> > >>> mutex_destroy(&hdev->lock);
> > >>> kfree(hdev);
> > >>> + devm_free_irq(core->dev, core->irq, core);
> > >> Could you please check and add the handling here [1] as well ?
> > >>
> > >> [1]
> > >> https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/media/platform/qcom/venus/core.c#L427
> > >
> > > hi Vikash, sorry I dont get your point - what do you mean?
> > IRQ need to be freed even for error cases during venus_probe().
> >
>
> but this is what the current patch does (venus_hfi_destroy is called at
> the end of probe error handling as well).
>
for background, this fixes a null derreference in the Venus driver -
reproduceable in RB3Gen2 on a particular error condition during probe.
> > Regards,
> > Vikash
> > >
> > >>
> > >> Regards,
> > >> Vikash
> > >>> core->ops = NULL;
> > >>> }
> > >>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] media: venus: hfi: explicitly release IRQ during teardown
2025-06-18 7:07 ` Jorge Ramirez
@ 2025-06-18 11:08 ` Bryan O'Donoghue
2025-06-18 13:13 ` Jorge Ramirez
0 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2025-06-18 11:08 UTC (permalink / raw)
To: Jorge Ramirez
Cc: Vikash Garodia, quic_dikshita, loic.poulain, mchehab,
hans.verkuil, linux-media, linux-arm-msm, linux-kernel
On 18/06/2025 08:07, Jorge Ramirez wrote:
> On 16/06/25 17:32:38, Jorge Ramirez wrote:
>> On 16/06/25 20:14:36, Vikash Garodia wrote:
>>> Hi Jorge,
>>>
>>> On 6/16/2025 6:29 PM, Jorge Ramirez wrote:
>>>> On 16/06/25 17:26:24, Vikash Garodia wrote:
>>>>>
>>>>> On 6/12/2025 1:59 PM, Jorge Ramirez-Ortiz wrote:
>>>>>> Ensure the IRQ is released before dismantling the ISR handler and
>>>>>> clearing related pointers.
>>>>>>
>>>>>> This prevents any possibility of the interrupt triggering after the
>>>>>> handler context has been invalidated.
>>>>>>
>>>>>> Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
>>>>>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
>>>>>> ---
>>>>>> drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
>>>>>> 1 file changed, 1 insertion(+)
>>>>>>
>>>>>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
>>>>>> index b5f2ea879950..d9d62d965bcf 100644
>>>>>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
>>>>>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
>>>>>> @@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
>>>>>> venus_interface_queues_release(hdev);
>>>>>> mutex_destroy(&hdev->lock);
>>>>>> kfree(hdev);
>>>>>> + devm_free_irq(core->dev, core->irq, core);
>>>>> Could you please check and add the handling here [1] as well ?
>>>>>
>>>>> [1]
>>>>> https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/media/platform/qcom/venus/core.c#L427
>>>>
>>>> hi Vikash, sorry I dont get your point - what do you mean?
>>> IRQ need to be freed even for error cases during venus_probe().
>>>
>>
>> but this is what the current patch does (venus_hfi_destroy is called at
>> the end of probe error handling as well).
>>
>
> for background, this fixes a null derreference in the Venus driver -
> reproduceable in RB3Gen2 on a particular error condition during probe.
Shouldn't it be the case that devm removes the handler for us anyway ?
Why not -> disable_irq_nosync(core->irq);
i.e. disable the IRQ until the normal/expected exit path removes it.
---
bod
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] media: venus: hfi: explicitly release IRQ during teardown
2025-06-18 11:08 ` Bryan O'Donoghue
@ 2025-06-18 13:13 ` Jorge Ramirez
0 siblings, 0 replies; 8+ messages in thread
From: Jorge Ramirez @ 2025-06-18 13:13 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Jorge Ramirez, Vikash Garodia, quic_dikshita, loic.poulain,
mchehab, hans.verkuil, linux-media, linux-arm-msm, linux-kernel
On 18/06/25 12:08:28, Bryan O'Donoghue wrote:
> On 18/06/2025 08:07, Jorge Ramirez wrote:
> > On 16/06/25 17:32:38, Jorge Ramirez wrote:
> > > On 16/06/25 20:14:36, Vikash Garodia wrote:
> > > > Hi Jorge,
> > > >
> > > > On 6/16/2025 6:29 PM, Jorge Ramirez wrote:
> > > > > On 16/06/25 17:26:24, Vikash Garodia wrote:
> > > > > >
> > > > > > On 6/12/2025 1:59 PM, Jorge Ramirez-Ortiz wrote:
> > > > > > > Ensure the IRQ is released before dismantling the ISR handler and
> > > > > > > clearing related pointers.
> > > > > > >
> > > > > > > This prevents any possibility of the interrupt triggering after the
> > > > > > > handler context has been invalidated.
> > > > > > >
> > > > > > > Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
> > > > > > > Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> > > > > > > ---
> > > > > > > drivers/media/platform/qcom/venus/hfi_venus.c | 1 +
> > > > > > > 1 file changed, 1 insertion(+)
> > > > > > >
> > > > > > > diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> > > > > > > index b5f2ea879950..d9d62d965bcf 100644
> > > > > > > --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> > > > > > > +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> > > > > > > @@ -1678,6 +1678,7 @@ void venus_hfi_destroy(struct venus_core *core)
> > > > > > > venus_interface_queues_release(hdev);
> > > > > > > mutex_destroy(&hdev->lock);
> > > > > > > kfree(hdev);
> > > > > > > + devm_free_irq(core->dev, core->irq, core);
> > > > > > Could you please check and add the handling here [1] as well ?
> > > > > >
> > > > > > [1]
> > > > > > https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/media/platform/qcom/venus/core.c#L427
> > > > >
> > > > > hi Vikash, sorry I dont get your point - what do you mean?
> > > > IRQ need to be freed even for error cases during venus_probe().
> > > >
> > >
> > > but this is what the current patch does (venus_hfi_destroy is called at
> > > the end of probe error handling as well).
> > >
> >
> > for background, this fixes a null derreference in the Venus driver -
> > reproduceable in RB3Gen2 on a particular error condition during probe.
> Shouldn't it be the case that devm removes the handler for us anyway ?
>
> Why not -> disable_irq_nosync(core->irq);
I agree, this seems better to me too.
I guess disable_irq() is the safer/more meaningfull choice since we are
calling from non irq context.
will fix - thanks for the suggestion!
>
> i.e. disable the IRQ until the normal/expected exit path removes it.
>
> ---
> bod
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-18 13:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 8:29 [PATCH] media: venus: hfi: explicitly release IRQ during teardown Jorge Ramirez-Ortiz
2025-06-16 11:56 ` Vikash Garodia
2025-06-16 12:59 ` Jorge Ramirez
2025-06-16 14:44 ` Vikash Garodia
2025-06-16 15:32 ` Jorge Ramirez
2025-06-18 7:07 ` Jorge Ramirez
2025-06-18 11:08 ` Bryan O'Donoghue
2025-06-18 13:13 ` Jorge Ramirez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).