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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190521145548.27844fa6@collabora.com>
Date:   Tue, 21 May 2019 14:55:48 +0200
From:   Boris Brezillon <boris.brezillon@...labora.com>
To:     Helen Koike <helen.koike@...labora.com>
Cc:     linux-media@...r.kernel.org, hverkuil-cisco@...all.nl,
        kernel@...labora.com, ezequiel.garcia@...labora.com,
        andrealmeid@...labora.com,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: vimc: fix component match compare

On Fri, 17 May 2019 14:20:11 -0300
Helen Koike <helen.koike@...labora.com> wrote:

> If the system has other devices being registered in the component
> framework, the compare function will be called with a device that
> doesn't belong to vimc.
> This device is not necessarily a platform_device, nor have a
> platform_data (which causes a NULL pointer dereference error) and if it
> does have a pdata, it is not necessarily type of struct vimc_platform_data.
> So casting to any of these types is wrong.
> 
> Instead of expecting a given pdev with a given pdata, just expect for
> the device it self. vimc-core is the one who creates them, we know in
> advance exactly which object to expect in the match.
> 
> Fixes: 4a29b7090749 ("[media] vimc: Subdevices as modules")

Oh, and you forgot to add

Cc: <stable@...r.kernel.org>

> Signed-off-by: Helen Koike <helen.koike@...labora.com>
> 
> ---
> 
>  drivers/media/platform/vimc/vimc-core.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c
> index 3aa62d7e3d0e..23992affd01f 100644
> --- a/drivers/media/platform/vimc/vimc-core.c
> +++ b/drivers/media/platform/vimc/vimc-core.c
> @@ -244,10 +244,7 @@ static void vimc_comp_unbind(struct device *master)
>  
>  static int vimc_comp_compare(struct device *comp, void *data)
>  {
> -	const struct platform_device *pdev = to_platform_device(comp);
> -	const char *name = data;
> -
> -	return !strcmp(pdev->dev.platform_data, name);
> +	return comp == data;
>  }
>  
>  static struct component_match *vimc_add_subdevs(struct vimc_device *vimc)
> @@ -277,7 +274,7 @@ static struct component_match *vimc_add_subdevs(struct vimc_device *vimc)
>  		}
>  
>  		component_match_add(&vimc->pdev.dev, &match, vimc_comp_compare,
> -				    (void *)vimc->pipe_cfg->ents[i].name);
> +				    &vimc->subdevs[i]->dev);
>  	}
>  
>  	return match;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ