diff mbox series

media: atomisp: Add check for rgby_data memory allocation failure

Message ID 20241101154823.3067891-1-lihuafei1@huawei.com (mailing list archive)
State New
Headers show
Series media: atomisp: Add check for rgby_data memory allocation failure | expand

Commit Message

Li Huafei Nov. 1, 2024, 3:48 p.m. UTC
In ia_css_3a_statistics_allocate(), there is no check on the allocation
result of the rgby_data memory. If rgby_data is not successfully
allocated, it may trigger the assert(host_stats->rgby_data) assertion in
ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.

Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
 drivers/staging/media/atomisp/pci/sh_css_params.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andy Shevchenko Nov. 1, 2024, 8:30 a.m. UTC | #1
On Fri, Nov 01, 2024 at 11:48:23PM +0800, Li Huafei wrote:
> In ia_css_3a_statistics_allocate(), there is no check on the allocation
> result of the rgby_data memory. If rgby_data is not successfully
> allocated, it may trigger the assert(host_stats->rgby_data) assertion in
> ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.

Not sure if this code even run on currently supported hardware / firmware,
but fix looks okay.

> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")

No, this is an intermediate commit, you should find the original, which is
earlier in the history.
Li Huafei Nov. 1, 2024, 9:57 a.m. UTC | #2
Hi Andy,

On 2024/11/1 16:30, Andy Shevchenko wrote:
> On Fri, Nov 01, 2024 at 11:48:23PM +0800, Li Huafei wrote:
>> In ia_css_3a_statistics_allocate(), there is no check on the allocation
>> result of the rgby_data memory. If rgby_data is not successfully
>> allocated, it may trigger the assert(host_stats->rgby_data) assertion in
>> ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.
> 
> Not sure if this code even run on currently supported hardware / firmware,
> but fix looks okay.
> 
>> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> 
> No, this is an intermediate commit, you should find the original, which is
> earlier in the history.
> 

Apologies, the correct fix tag should be:

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")

If this fix can be applied, do I need to send a v2, or can you help add the Fix tag?

Thanks,
Huafei
Andy Shevchenko Nov. 1, 2024, 10:16 a.m. UTC | #3
On Fri, Nov 01, 2024 at 05:57:36PM +0800, Li Huafei wrote:
> On 2024/11/1 16:30, Andy Shevchenko wrote:
> > On Fri, Nov 01, 2024 at 11:48:23PM +0800, Li Huafei wrote:
> >> In ia_css_3a_statistics_allocate(), there is no check on the allocation
> >> result of the rgby_data memory. If rgby_data is not successfully
> >> allocated, it may trigger the assert(host_stats->rgby_data) assertion in
> >> ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.
> > 
> > Not sure if this code even run on currently supported hardware / firmware,
> > but fix looks okay.
> > 
> >> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> > 
> > No, this is an intermediate commit, you should find the original, which is
> > earlier in the history.
> 
> Apologies, the correct fix tag should be:
> 
> Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
> 
> If this fix can be applied, do I need to send a v2, or can you help add the Fix tag?

Up to Hans, but there is another question left unanswered about SoB chain.
Can you clarify that?
Andy Shevchenko Nov. 1, 2024, 10:55 a.m. UTC | #4
On Fri, Nov 01, 2024 at 12:16:03PM +0200, Andy Shevchenko wrote:
> On Fri, Nov 01, 2024 at 05:57:36PM +0800, Li Huafei wrote:
> > On 2024/11/1 16:30, Andy Shevchenko wrote:
> > > On Fri, Nov 01, 2024 at 11:48:23PM +0800, Li Huafei wrote:
> > >> In ia_css_3a_statistics_allocate(), there is no check on the allocation
> > >> result of the rgby_data memory. If rgby_data is not successfully
> > >> allocated, it may trigger the assert(host_stats->rgby_data) assertion in
> > >> ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.
> > > 
> > > Not sure if this code even run on currently supported hardware / firmware,
> > > but fix looks okay.
> > > 
> > >> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> > > 
> > > No, this is an intermediate commit, you should find the original, which is
> > > earlier in the history.
> > 
> > Apologies, the correct fix tag should be:
> > 
> > Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
> > 
> > If this fix can be applied, do I need to send a v2, or can you help add the Fix tag?
> 
> Up to Hans, but there is another question left unanswered about SoB chain.
> Can you clarify that?

Ah, sorry, I misread the From and answered to the wrong thread.
Fixes tag seems better now.
Li Huafei Nov. 4, 2024, 7:30 a.m. UTC | #5
On 2024/11/1 18:55, Andy Shevchenko wrote:
> On Fri, Nov 01, 2024 at 12:16:03PM +0200, Andy Shevchenko wrote:
>> On Fri, Nov 01, 2024 at 05:57:36PM +0800, Li Huafei wrote:
>>> On 2024/11/1 16:30, Andy Shevchenko wrote:
>>>> On Fri, Nov 01, 2024 at 11:48:23PM +0800, Li Huafei wrote:
>>>>> In ia_css_3a_statistics_allocate(), there is no check on the allocation
>>>>> result of the rgby_data memory. If rgby_data is not successfully
>>>>> allocated, it may trigger the assert(host_stats->rgby_data) assertion in
>>>>> ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.
>>>>
>>>> Not sure if this code even run on currently supported hardware / firmware,
>>>> but fix looks okay.
>>>>
>>>>> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
>>>>
>>>> No, this is an intermediate commit, you should find the original, which is
>>>> earlier in the history.
>>>
>>> Apologies, the correct fix tag should be:
>>>
>>> Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
>>>
>>> If this fix can be applied, do I need to send a v2, or can you help add the Fix tag?
>>
>> Up to Hans, but there is another question left unanswered about SoB chain.
>> Can you clarify that?
> 
> Ah, sorry, I misread the From and answered to the wrong thread.
> Fixes tag seems better now.
> 
Okay, I have sent v2:

v2: https://lore.kernel.org/lkml/20241104145051.3088231-1-lihuafei1@huawei.com/

Thanks,
Huafei
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
index 232744973ab8..b1feb6f6ebe8 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
@@ -4181,6 +4181,8 @@  ia_css_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid)
 		goto err;
 	/* No weighted histogram, no structure, treat the histogram data as a byte dump in a byte array */
 	me->rgby_data = kvmalloc(sizeof_hmem(HMEM0_ID), GFP_KERNEL);
+	if (!me->rgby_data)
+		goto err;
 
 	IA_CSS_LEAVE("return=%p", me);
 	return me;