lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190531102956.rd5q72yobbdwyut5@valkosipuli.retiisi.org.uk>
Date:   Fri, 31 May 2019 13:29:56 +0300
From:   Sakari Ailus <sakari.ailus@....fi>
To:     Nikita Yushchenko <nikita.yoush@...entembedded.com>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Hans Verkuil <hverkuil@...all.nl>,
        Shuah Khan <shuah@...nel.org>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: avoid skipping MEDIA_PAD_FL_MUST_CONNECT logic

Hi Nikita,

On Fri, May 31, 2019 at 11:06:37AM +0300, Nikita Yushchenko wrote:
> In the current code, __media_pipeline_start() skips check of
> MEDIA_PAD_FL_MUST_CONNECT logic for entity not providing link_validate()
> op.
> 
> Fix that by checking for existence of link_validate() at different code
> location.
> 
> Signed-off-by: Nikita Yushchenko <nikita.yoush@...entembedded.com>
> ---
>  drivers/media/mc/mc-entity.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
> index a998a2e0ea1d..8b4912be30d1 100644
> --- a/drivers/media/mc/mc-entity.c
> +++ b/drivers/media/mc/mc-entity.c
> @@ -449,9 +449,6 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
>  		if (entity->stream_count > 1)
>  			continue;
>  
> -		if (!entity->ops || !entity->ops->link_validate)
> -			continue;
> -
>  		bitmap_zero(active, entity->num_pads);
>  		bitmap_fill(has_no_links, entity->num_pads);
>  
> @@ -479,6 +476,9 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
>  			    !(link->flags & MEDIA_LNK_FL_ENABLED))
>  				continue;
>  
> +			if (!entity->ops || !entity->ops->link_validate)
> +				continue;
> +
>  			ret = entity->ops->link_validate(link);
>  			if (ret < 0 && ret != -ENOIOCTLCMD) {
>  				dev_dbg(entity->graph_obj.mdev->dev,

Thanks for the patch. This generally hasn't been an issue as drivers do
implement link_validate function. But it still is a bug in the code.

The link validation function does not change during the loop. How about
caching it locally and implementing a static nop variant you call in case
there's nothing to theck, so there's no need to check for entity->ops and
the entity->ops->link_validate separately on every iteration?

-- 
Kind regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ