On Thu, May 23, 2019 at 04:10:38PM -0300, Jason Gunthorpe wrote: > > On Thu, May 23, 2019 at 02:24:58PM -0400, Jerome Glisse wrote: > > I can not take mmap_sem in range_register, the READ_ONCE is fine and > > they are no race as we do take a reference on the hmm struct thus > > Of course there are use after free races with a READ_ONCE scheme, I > shouldn't have to explain this. Well i can not think of anything again here the mm->hmm can not change while driver is calling hmm_range_register() so if you want i can remove the READ_ONCE() this does not change anything. > If you cannot take the read mmap sem (why not?), then please use my > version and push the update to the driver through -mm.. Please see previous threads on why it was a failure. Cheers, Jérôme