Re: [PATCH] drm/i915/gvt: Use after free in intel_vgpu_destroy_ggtt_mm()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018.11.23 10:22:19 +0300, Dan Carpenter wrote:
> We need to use the _safe() version of this macro so that we don't
> dereference "pos" when it is freed.
>

Thanks, Dan.

I've already merged one same fix from Chris for this found by smatch.

> Fixes: bc0686ff5fad ("drm/i915/gvt: support inconsecutive partial gtt entry write")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/gvt/gtt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> index 58e166effa45..3f416341ae5f 100644
> --- a/drivers/gpu/drm/i915/gvt/gtt.c
> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> @@ -2447,9 +2447,9 @@ static void intel_vgpu_destroy_all_ppgtt_mm(struct intel_vgpu *vgpu)
>  
>  static void intel_vgpu_destroy_ggtt_mm(struct intel_vgpu *vgpu)
>  {
> -	struct intel_gvt_partial_pte *pos;
> +	struct intel_gvt_partial_pte *pos, *n;
>  
> -	list_for_each_entry(pos,
> +	list_for_each_entry_safe(pos, n,
>  			&vgpu->gtt.ggtt_mm->ggtt_mm.partial_pte_list, list) {
>  		gvt_dbg_mm("partial PTE update on hold 0x%lx : 0x%llx\n",
>  			pos->offset, pos->data);
> -- 
> 2.11.0
> 

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux