[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJedcCyvSW_RAOrzUkWM8Li8x6Jkd0FL6uCXCz2Jzk33dng4jQ@mail.gmail.com>
Date: Wed, 21 Dec 2022 13:01:26 +0800
From: Zheng Hacker <hackerzheng666@...il.com>
To: Zhenyu Wang <zhenyuw@...ux.intel.com>
Cc: Zheng Wang <zyytlz.wz@....com>, zhi.a.wang@...el.com,
alex000young@...il.com, security@...nel.org,
intel-gvt-dev@...ts.freedesktop.org,
tvrtko.ursulin@...ux.intel.com, airlied@...ux.ie,
gregkh@...uxfoundation.org, intel-gfx@...ts.freedesktop.org,
joonas.lahtinen@...ux.intel.com, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, 1002992920@...com, airlied@...il.com
Subject: Re: [PATCH v5] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry
Zhenyu Wang <zhenyuw@...ux.intel.com> 于2022年12月21日周三 11:01写道:
>
> On 2022.12.20 17:40:14 +0800, Zheng Wang wrote:
> > If intel_gvt_dma_map_guest_page failed, it will call
> > ppgtt_invalidate_spt, which will finally free the spt. But the
> > caller function ppgtt_populate_spt_by_guest_entry does not notice
> > that, it will free spt again in its error path.
>
> indent
Yeap :)
> > + if (ret)
> > + goto err;
> > sub_se.val64 = se->val64;
> >
> > /* Copy the PAT field from PDE. */
> > @@ -1231,6 +1229,18 @@ static int split_2MB_gtt_entry(struct intel_vgpu *vgpu,
> > ops->set_pfn(se, sub_spt->shadow_page.mfn);
> > ppgtt_set_shadow_entry(spt, se, index);
> > return 0;
> > +err:
> > + /* Undone the existing mappings of DMA addr. */
>
> We need a verb here for Undo.
Get it.
>
> > + for_each_present_shadow_entry(sub_spt, &sub_se, sub_index) {
> > + gvt_vdbg_mm("invalidate 4K entry\n");
> > + ppgtt_invalidate_pte(sub_spt, &sub_se);
> > + }
> > + /* Release the new allocated spt. */
> > + trace_spt_change(sub_spt->vgpu->id, "release", sub_spt,
> > + sub_spt->guest_page.gfn, sub_spt->shadow_page.type);
> > + ppgtt_free_spt(sub_spt);
> > + sub_spt = NULL;
>
> Not need to reset local variable that has no use then.
>
> I'll handle these trivial fixes during the merge.
>
Very thanks for that.
Best regards,
Zheng Wang
Powered by blists - more mailing lists