Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: Marek Vasut <marex@denx.de>,
	linux-media@vger.kernel.org, Fabio Estevam <festevam@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	NXP Linux Team <linux-imx@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] media: nxp: isi: Check whether pad is non-NULL before access
Date: Thu, 11 Jan 2024 19:52:31 +0200	[thread overview]
Message-ID: <20240111175231.GC6806@pendragon.ideasonboard.com> (raw)
In-Reply-To: <170499538140.3227220.17574476088989803181@ping.linuxembedded.co.uk>

On Thu, Jan 11, 2024 at 05:49:41PM +0000, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2023-12-03 16:59:59)
> > Hi Marek,
> > 
> > Thank you for the patch.
> > 
> > On Fri, Dec 01, 2023 at 04:06:04PM +0100, Marek Vasut wrote:
> > > The pad can be NULL if media controller routing is not set up correctly.
> > > Check whether the pad is NULL before using it, otherwise it is possible
> > > to achieve NULL pointer dereference.
> > 
> > Could you share more information about how to misconfigure the routing ?
> 
> You simply do 'nothing'.

The default configuration should be working one. I think that should
then be fixed too (in a separate patch).

> > > Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
> > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > ---
> > > Cc: Fabio Estevam <festevam@gmail.com>
> > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > > Cc: NXP Linux Team <linux-imx@nxp.com>
> > > Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> > > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > > Cc: Shawn Guo <shawnguo@kernel.org>
> > > Cc: linux-arm-kernel@lists.infradead.org
> > > Cc: linux-media@vger.kernel.org
> > > ---
> > >  drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c | 8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> > > index 792f031e032ae..44354931cf8a1 100644
> > > --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> > > +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> > > @@ -160,8 +160,14 @@ mxc_isi_crossbar_xlate_streams(struct mxc_isi_crossbar *xbar,
> > >       }
> > >  
> > >       pad = media_pad_remote_pad_first(&xbar->pads[sink_pad]);
> > > -     sd = media_entity_to_v4l2_subdev(pad->entity);
> > > +     if (!pad) {
> > > +             dev_dbg(xbar->isi->dev,
> > > +                     "no pad connected to crossbar input %u\n",
> > > +                     sink_pad);
> > > +             return ERR_PTR(-EPIPE);
> > > +     }
> > >  
> > > +     sd = media_entity_to_v4l2_subdev(pad->entity);
> > >       if (!sd) {
> > >               dev_dbg(xbar->isi->dev,
> > >                       "no entity connected to crossbar input %u\n",
> > 
> > -- 
> > Regards,
> > 
> > Laurent Pinchart

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-01-11 17:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 15:06 [PATCH] media: nxp: isi: Check whether pad is non-NULL before access Marek Vasut
2023-12-02  2:27 ` Fabio Estevam
2023-12-02  6:44   ` Marek Vasut
2023-12-03 17:00     ` Laurent Pinchart
2024-01-11 17:52       ` Kieran Bingham
2023-12-03 16:59 ` Laurent Pinchart
2024-01-11 17:49   ` Kieran Bingham
2024-01-11 17:52     ` Laurent Pinchart [this message]
2024-01-13  0:03       ` Laurent Pinchart
2024-01-13  0:21         ` Laurent Pinchart
2024-01-13  3:05         ` Marek Vasut

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=20240111175231.GC6806@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mchehab@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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