It is the responsibility of the device driver to lock all memory that is to be used for DMA, and to ensure that it stays locked.
If the memory is already locked, the driver still has to get an additional reference to the page to prevent it from being unlocked too early.