[Intel-gfx] [PATCH] drm/i915/gvt: Use after free in intel_vgpu_destroy_ggtt_mm()
Zhenyu Wang
zhenyuw at linux.intel.com
Fri Nov 23 07:30:20 UTC 2018
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 at oracle.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20181123/42920c2c/attachment.sig>
More information about the Intel-gfx
mailing list