linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: media: staging/imx: Improve pipeline searching (bug report)
@ 2019-06-26 18:27 Colin Ian King
  2019-06-26 18:35 ` Steve Longerbeam
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2019-06-26 18:27 UTC (permalink / raw)
  To: Steve Longerbeam, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, Shawn Guo, Rui Miguel Silva, linux-media,
	devel, linux-arm-kernel
  Cc: linux-kernel

Hi,

Static analysis with Coverity on Linux next has found a potential issue
with the following commit:

commit 3ef46bc97ca2c918b7657a08220c7340a9bb07a2
Author: Steve Longerbeam <slongerbeam@gmail.com>
Date:   Fri May 10 17:50:11 2019 -0400

    media: staging/imx: Improve pipeline searching


The issue is in drivers/staging/media/imx/imx-media-utils.c in function
find_pipeline_entity:

        struct media_pad *pad = NULL;

pad is assigned a NULL

        struct video_device *vfd;
        struct v4l2_subdev *sd;

        if (grp_id && is_media_entity_v4l2_subdev(start)) {
                sd = media_entity_to_v4l2_subdev(start);
                if (sd->grp_id & grp_id)
                        return &sd->entity;
        } else if (buftype && is_media_entity_v4l2_video_device(start)) {
                vfd = media_entity_to_video_device(pad->entity);

..and above the null pad is being dereferenced causing a kernel oops.

                if (buftype == vfd->queue->type)
                        return &vfd->entity;
        }


Colin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: media: staging/imx: Improve pipeline searching (bug report)
  2019-06-26 18:27 media: staging/imx: Improve pipeline searching (bug report) Colin Ian King
@ 2019-06-26 18:35 ` Steve Longerbeam
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Longerbeam @ 2019-06-26 18:35 UTC (permalink / raw)
  To: Colin Ian King, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, Shawn Guo, Rui Miguel Silva, linux-media,
	devel, linux-arm-kernel
  Cc: linux-kernel

Thanks for catching,

On 6/26/19 11:27 AM, Colin Ian King wrote:
> Hi,
>
> Static analysis with Coverity on Linux next has found a potential issue
> with the following commit:
>
> commit 3ef46bc97ca2c918b7657a08220c7340a9bb07a2
> Author: Steve Longerbeam <slongerbeam@gmail.com>
> Date:   Fri May 10 17:50:11 2019 -0400
>
>      media: staging/imx: Improve pipeline searching
>
>
> The issue is in drivers/staging/media/imx/imx-media-utils.c in function
> find_pipeline_entity:
>
>          struct media_pad *pad = NULL;
>
> pad is assigned a NULL
>
>          struct video_device *vfd;
>          struct v4l2_subdev *sd;
>
>          if (grp_id && is_media_entity_v4l2_subdev(start)) {
>                  sd = media_entity_to_v4l2_subdev(start);
>                  if (sd->grp_id & grp_id)
>                          return &sd->entity;
>          } else if (buftype && is_media_entity_v4l2_video_device(start)) {
>                  vfd = media_entity_to_video_device(pad->entity);
>
> ..and above the null pad is being dereferenced causing a kernel oops.

yes, this is a typo and should be:

vfd = media_entity_to_video_device(start);


Sending a patch...

Steve


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-26 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 18:27 media: staging/imx: Improve pipeline searching (bug report) Colin Ian King
2019-06-26 18:35 ` Steve Longerbeam

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).