From: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-staging@lists.linux.dev, Hans de Goede <hansg@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Andy Shevchenko <andy@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Cox <alan@linux.intel.com>,
azpijr@gmail.com, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] media: atomisp: fix potential NULL pointer dereference in configure_isp_from_args()
Date: Tue, 31 Mar 2026 07:57:39 +0200 [thread overview]
Message-ID: <actfdnYcTbqg0gvW@gmail.com> (raw)
In-Reply-To: <CAHp75VezSSid9b5qNzvMjUS7QTJaKtBhhVVnuS+-sjVe_a=CxQ@mail.gmail.com>
On Mon, Mar 30, 2026 at 11:59:24AM +0300, Andy Shevchenko wrote:
> On Sat, Mar 28, 2026 at 9:27 PM Jose A. Perez de Azpillaga
> <azpijr@gmail.com> wrote:
> >
> > The function configure_isp_from_args() incorrectly dereferences
> > args->delay_frames[0] to configure cropping without checking if the
> > pointer is valid. However, as noted in a FIXME comment later in the
> > same function, delay_frames can be NULL in certain pipeline
> > configurations.
> >
> > Add defensive checks for both delay_frames and tnr_frames before passing
> > them to their respective configuration functions. This ensures that
> > optional frames are only processed if they were actually allocated,
> > preventing a kernel NULL pointer dereference.
>
> Have you experienced bugs IRL?
>
not really, I don't have the hardware, but while reading the code, I found
it to be logically inconsistent. imo, the comment is misplaced since
delay_frames can be null earlier.
> ...
>
> > /*
> > - * FIXME: args->delay_frames can be NULL here
> > - *
> > - * Somehow, the driver at the Intel Atom Yocto tree doesn't seem to
> > - * suffer from the same issue.
> > - *
> > - * Anyway, the function below should now handle a NULL delay_frames
> > - * without crashing, but the pipeline should likely be built without
> > - * adding it at the first place (or there are a hidden bug somewhere)
> > + * Safely handle pipelines built without delay_frames
> > */
>
> This comment suggests something different. What the proposed change is
> doing is just skipping the invalid data without actual understanding
> of the root cause.
>
you are right here. I should've done a deeper analysis instead of focusing only
on that function. looking more closely at how the pipeline is built, I found that
these frames are intentionally skipped during allocation to save memory when a
specific feature isn't enabled.
the configuration path was just ignoring those enable flags and trying to use the frames
anyway. instead of a NULL check, maybe I should try gating these calls behind the actual
feature flags in the binary info.
if this is a better approach, I'll send a v2 with these changes. :)
...
regards,
jose a. p-a
next prev parent reply other threads:[~2026-03-31 5:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-28 19:21 [PATCH v1 0/2] media: atomisp: harden and clean up isp configuration Jose A. Perez de Azpillaga
2026-03-28 19:21 ` [PATCH v1 1/2] media: atomisp: fix potential NULL pointer dereference in configure_isp_from_args() Jose A. Perez de Azpillaga
2026-03-30 8:59 ` Andy Shevchenko
2026-03-31 5:57 ` Jose A. Perez de Azpillaga [this message]
2026-03-31 7:04 ` Andy Shevchenko
2026-03-30 9:35 ` Dan Carpenter
2026-03-31 6:07 ` Jose A. Perez de Azpillaga
2026-03-31 6:13 ` Jose A. Perez de Azpillaga
2026-03-28 19:21 ` [PATCH v1 2/2] media: atomisp: remove redundant call to ia_css_output0_configure() Jose A. Perez de Azpillaga
2026-03-30 9:01 ` Andy Shevchenko
2026-03-31 6:03 ` Jose A. Perez de Azpillaga
2026-03-31 7:08 ` Andy Shevchenko
2026-03-30 9:35 ` Dan Carpenter
2026-03-31 6:11 ` Jose A. Perez de Azpillaga
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=actfdnYcTbqg0gvW@gmail.com \
--to=azpijr@gmail.com \
--cc=alan@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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