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> > 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 > Signed-off-by: Colin Ian King > --- > 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 = >dev; > - struct vpu_run *run = >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 = >run; > + > mutex_lock(>vpu_mutex); > if (vpu->fw_loaded) { > mutex_unlock(>vpu_mutex); -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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> > 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:Tiffany Lin > Signed-off-by: Colin Ian King > --- > 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 = >dev; > - struct vpu_run *run = >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 = >run; > + > mutex_lock(>vpu_mutex); > if (vpu->fw_loaded) { > mutex_unlock(>vpu_mutex); -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media] VPU: mediatek: fix null pointer dereference on pdev
From: Colin Ian Kingpdev 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. Signed-off-by: Colin Ian King --- 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 = >dev; - struct vpu_run *run = >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 = >run; + mutex_lock(>vpu_mutex); if (vpu->fw_loaded) { mutex_unlock(>vpu_mutex); -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html