Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-12-21 Thread Zheng Wang
Hi Zhi, Thanks again for your reply and clear explaination about the function. I still have some doubt about the fix. Here is a invoke chain : ppgtt_populate_spt ->ppgtt_populate_shadow_entry ->split_2MB_gtt_entry As far as I'm concerned, when something error happens in DMA mapping, which

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-12-21 Thread Zheng Wang
Wang, Zhi A 于2022年12月19日周一 16:22写道: > > I think it is a case-by-case thing. For example: > > The current scenario in this function looks like below: > > caller pass spt a > function > alloc spt b > something error > free spt a > return error > > The problem is:

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-12-19 Thread Wang, Zhi A
On 12/19/2022 9:57 AM, Zheng Wang wrote: > Hi Zhi, > > Thanks again for your reply and clear explaination about the function. > I still have some doubt about the fix. Here is a invoke chain : > ppgtt_populate_spt >->ppgtt_populate_shadow_entry > ->split_2MB_gtt_entry > As far as I'm

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-12-15 Thread Zheng Hacker
Hi Zhi, Thanks for your reply and suggestion about fix. I am a little bit busy now. I will review the code as soon as possible. Also thanks Joonas for the reminding. We'll try to think out the new fix. Best regards, Zheng Wang

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-12-15 Thread Wang, Zhi A
On 12/15/2022 12:47 PM, Joonas Lahtinen wrote: > (+ Tvrtko as FYI) > > Zhenyu, can you take a look at the patch ASAP. > > Regards, Joonas Thanks so much for the reminding and patch. Actually I don't think it is proper fix as: split_2MB_gtt_entry() is going to allocate a new spt structure,

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-12-15 Thread Joonas Lahtinen
(+ Tvrtko as FYI) Zhenyu, can you take a look at the patch ASAP. Regards, Joonas Quoting Dave Airlie (2022-10-27 08:12:31) > On Thu, 27 Oct 2022 at 13:26, Zheng Hacker wrote: > > > > Dave Airlie 于2022年10月27日周四 08:01写道: > > > > > > On Fri, 7 Oct 2022 at 11:38, Zheng Wang wrote: > > > > > > >

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-10-30 Thread Zheng Hacker
Dave Airlie 于2022年10月27日周四 13:12写道: > I'll add some more people who can probably look at it. > > Dave. Got it, Thanks Dave. Regards, Zheng Wang

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-10-26 Thread Dave Airlie
On Thu, 27 Oct 2022 at 13:26, Zheng Hacker wrote: > > Dave Airlie 于2022年10月27日周四 08:01写道: > > > > On Fri, 7 Oct 2022 at 11:38, 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

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-10-26 Thread Zheng Hacker
Dave Airlie 于2022年10月27日周四 08:01写道: > > On Fri, 7 Oct 2022 at 11:38, 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 does not notice that, it will free spt again in error path. > > > >

Re: [Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-10-26 Thread Dave Airlie
On Fri, 7 Oct 2022 at 11:38, 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 does not notice that, it will free spt again in error path. > > Fix this by spliting invalidate and free in

[Intel-gfx] [PATCH v3] drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

2022-10-10 Thread Zheng Wang
If intel_gvt_dma_map_guest_page failed, it will call ppgtt_invalidate_spt, which will finally free the spt. But the caller does not notice that, it will free spt again in error path. Fix this by spliting invalidate and free in ppgtt_invalidate_spt. Only free spt when in good case. Reported-by: