[PATCH] nvme-pci: avoid dereference of symbol from unloaded module

Sagi Grimberg sagi at grimberg.me
Thu Nov 2 05:10:16 PDT 2017


> The 'remove_work' may be scheduled to run after nvme_remove()
> returns since we can't simply cancel it in nvme_remove() for
> avoiding deadlock. Once nvme_remove() returns, this module(nvme)
> can be unloaded.
> 
> On the other hand, nvme_put_ctrl() calls ctr->ops->free_ctrl
> which may point to nvme_pci_free_ctrl() in unloaded module.
> 
> This patch avoids this issue by holding the module refcount before
> scheduling 'remove_work'.

Why not simply flushing all scheduled works in module exit?



More information about the Linux-nvme mailing list