From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Alain Volmat <alain.volmat@foss.st.com>,
Hugues Fruchet <hugues.fruchet@foss.st.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: stable@vger.kernel.org, linux-media@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: stm32: dcmipp: correct error handling in dcmipp_create_subdevs
Date: Thu, 27 Jun 2024 13:17:55 +0200 [thread overview]
Message-ID: <8587b6cd-2d04-4a2e-b298-e57c792332f1@xs4all.nl> (raw)
In-Reply-To: <20240624084123.3009122-1-alain.volmat@foss.st.com>
On 24/06/2024 10:41, Alain Volmat wrote:
> Correct error handling within the dcmipp_create_subdevs by properly
> decrementing the i counter when releasing the subdeves.
>
> Fixes: 28e0f3772296 ("media: stm32-dcmipp: STM32 DCMIPP camera interface driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
> ---
> drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> index 4acc3b90d03a..4924ee36cfda 100644
> --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> @@ -202,7 +202,7 @@ static int dcmipp_create_subdevs(struct dcmipp_device *dcmipp)
> return 0;
>
> err_init_entity:
> - while (i > 0)
> + while (i-- > 0)
> dcmipp->pipe_cfg->ents[i - 1].release(dcmipp->entity[i - 1]);
> return ret;
> }
I accidentally merged this one, but this patch isn't right.
After this change the [i - 1] indices should be changed to [i].
If i == 1, then the while condition is true, but now i == 0 in the
actual statement, so you access out-of-bounds values.
I decided to revert it, since it is better to just get stuck in the
while loop, then to crash.
But a new patch is needed for this.
Regards,
Hans
next prev parent reply other threads:[~2024-06-27 11:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 8:41 [PATCH] media: stm32: dcmipp: correct error handling in dcmipp_create_subdevs Alain Volmat
2024-06-27 11:17 ` Hans Verkuil [this message]
2024-06-27 11:25 ` Sakari Ailus
-- strict thread matches above, loose matches on Subject: below --
2024-07-03 11:59 [PATCH] media: stm32: dcmipp: correct error handling in, dcmipp_create_subdevs Hans Verkuil
2024-07-05 10:15 ` Alain Volmat
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=8587b6cd-2d04-4a2e-b298-e57c792332f1@xs4all.nl \
--to=hverkuil-cisco@xs4all.nl \
--cc=alain.volmat@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=hugues.fruchet@foss.st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mchehab@kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.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