From: Hans Verkuil <hverkuil@xs4all.nl>
To: Sakari Ailus <sakari.ailus@linux.intel.com>, linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH 1/1] media: Check for active and has_no_links overrun
Date: Thu, 7 Sep 2017 14:18:59 +0200 [thread overview]
Message-ID: <de9b504a-26d5-f681-7628-b8a2836403f0@xs4all.nl> (raw)
In-Reply-To: <20170829134640.7054-1-sakari.ailus@linux.intel.com>
On 08/29/17 15:46, Sakari Ailus wrote:
> From: Sakari Ailus <sakari.ailus@iki.fi>
>
> The active and has_no_links arrays will overrun in
> media_entity_pipeline_start() if there's an entity which has more than
> MEDIA_ENTITY_MAX_PAD pads. Ensure in media_entity_init() that there are
> fewer pads than that.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Thanks!
Hans
> ---
> drivers/media/media-entity.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 2ace0410d277..f7c6d64e6031 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -214,12 +214,20 @@ void media_gobj_destroy(struct media_gobj *gobj)
> gobj->mdev = NULL;
> }
>
> +/*
> + * TODO: Get rid of this.
> + */
> +#define MEDIA_ENTITY_MAX_PADS 512
> +
> int media_entity_pads_init(struct media_entity *entity, u16 num_pads,
> struct media_pad *pads)
> {
> struct media_device *mdev = entity->graph_obj.mdev;
> unsigned int i;
>
> + if (num_pads >= MEDIA_ENTITY_MAX_PADS)
> + return -E2BIG;
> +
> entity->num_pads = num_pads;
> entity->pads = pads;
>
> @@ -280,11 +288,6 @@ static struct media_entity *stack_pop(struct media_graph *graph)
> #define link_top(en) ((en)->stack[(en)->top].link)
> #define stack_top(en) ((en)->stack[(en)->top].entity)
>
> -/*
> - * TODO: Get rid of this.
> - */
> -#define MEDIA_ENTITY_MAX_PADS 512
> -
> /**
> * media_graph_walk_init - Allocate resources for graph walk
> * @graph: Media graph structure that will be used to walk the graph
>
prev parent reply other threads:[~2017-09-07 12:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 13:46 [PATCH 1/1] media: Check for active and has_no_links overrun Sakari Ailus
2017-09-07 12:18 ` Hans Verkuil [this message]
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=de9b504a-26d5-f681-7628-b8a2836403f0@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
--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;
as well as URLs for NNTP newsgroup(s).