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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 9 Sep 2016 09:25:14 +0800
From:   andrew-ct chen <andrew-ct.chen@...iatek.com>
To:     Colin King <colin.king@...onical.com>
CC:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Hans Verkuil <hans.verkuil@...co.com>,
        "Wei Yongjun" <yongjun_wei@...ndmicro.com.cn>,
        Tiffany Lin <tiffany.lin@...iatek.com>,
        <linux-media@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [media] VPU: mediatek: fix null pointer dereference on
 pdev

On Wed, 2016-09-07 at 18:10 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
> 
> pdev is being null checked, however, prior to that it is being
> dereferenced by platform_get_drvdata.  Move the assignments of
> vpu and run to after the pdev null check to avoid a potential
> null pointer dereference.
> 

Reviewed-by:Andrew-CT Chen <andrew-ct.chen@...iatek.com>

> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/media/platform/mtk-vpu/mtk_vpu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c
> index c9bf58c..43907a3 100644
> --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c
> +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
> @@ -523,9 +523,9 @@ static int load_requested_vpu(struct mtk_vpu *vpu,
>  
>  int vpu_load_firmware(struct platform_device *pdev)
>  {
> -	struct mtk_vpu *vpu = platform_get_drvdata(pdev);
> +	struct mtk_vpu *vpu;
>  	struct device *dev = &pdev->dev;
> -	struct vpu_run *run = &vpu->run;
> +	struct vpu_run *run;
>  	const struct firmware *vpu_fw = NULL;
>  	int ret;
>  
> @@ -534,6 +534,9 @@ int vpu_load_firmware(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> +	vpu = platform_get_drvdata(pdev);
> +	run = &vpu->run;
> +
>  	mutex_lock(&vpu->vpu_mutex);
>  	if (vpu->fw_loaded) {
>  		mutex_unlock(&vpu->vpu_mutex);


Powered by blists - more mailing lists