Wang, Zhi A <zhi.a.wang@xxxxxxxxx> 于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: the function wrongly frees the spt a instead free what > it allocates. Thanks for your clear explaination. It’s really helpfult to me. I think I might know how to fix now. > A proper fix should be: > > caller pass spt a > function > alloc spt b > something error > *free spt b* > return error > As it's a case-by-case thing, I'll extract the un-done-mapping-dma part from ppgtt_invalidate_spt and put it in error path. Then I'll add the code of freeing new allocated spt. If I misunderstand your meaning, feel free to let me know. Working on a new fix now. Best regards, Zheng Wang