In the Linux kernel, the following vulnerability has been resolved: xen: fix UAF in dmabufexpfrompages() [dmabuffd() fixes; no preferences regarding the tree it goes through - up to xen folks] As soon as we'd inserted a file reference into descriptor table, another thread could close it. That's fine for the case when all we are doing is returning that descriptor to userland (it's a race, but it's a userland race and there's nothing the kernel can do about it). However, if we follow fdinstall() with any kind of access to objects that would be destroyed on close (be it the struct file itself or anything destroyed by its ->release()), we have a UAF. dmabuffd() is a combination of reserving a descriptor and fdinstall(). gntdev dmabufexpfrompages() calls it and then proceeds to access the objects destroyed on close - starting with gntdevdmabuf itself. Fix that by doing reserving descriptor before anything else and do fdinstall() only when everything had been set up.