On Thu, Jan 22, 2026 at 12:32:03PM +0100, Christian König wrote:
What roughly happens is that each DMA-buf mapping through a couple of hoops keeps a reference on the device, so even after a hotplug event the device can only fully go away after all housekeeping structures are destroyed and buffers freed.
A simple reference on the device means nothing for these kinds of questions. It does not stop unloading and reloading a driver.
Well as far as I know it stops the PCIe address space from being re-used.
So when you do an "echo 1 > remove" and then an re-scan on the upstream bridge that works, but you get different addresses for your MMIO BARs!
That's pretty a niche scenario.. Most people don't rescan their PCI bus. If you just do rmmod/insmod then it will be re-used, there is no rescan to move the MMIO around on that case.
Oh, well I never looked to deeply into that.
As far as I know it doesn't block, but rather the last drm_dev_put() just cleans things up.
And we have a CI test system which exercises that stuff over and over again because we have a big customer depending on that.
I doubt a CI would detect a UAF like we are discussing here..
Connect a RDMA pinned importer. Do rmmod. If rmmod doesn't hang the driver has a UAF on some RAS cases. Not great, but is unlikely to actually trouble any real user.
Jason