Re: [PATCH v4 02/18] PCI/P2PDMA: Wait for RCU readers before freeing state
| Newsgroups | org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
> From: Leon Romanovsky <[email protected]> > > pci_p2pmem_find_many() scans all PCI devices without locking or > protection against driver unbind, including devices with poolless > P2PDMA state. pci_has_p2pmem() may observe pdev->p2pdma just before > driver unbind clears it, while pci_p2pdma_release() skips the grace > period when no pool is present. This allows devres to free the object > while it is still in use. > > Clear the pointer with RCU_INIT_POINTER() and always wait for pre-existing > RCU readers before returning. The same grace period continues to protect > gen_pool users for pool-backed providers. > > Tested-by: Tushar Dave <[email protected]> > Cc: Alex Williamson <[email protected]> > Cc: Matt Evans <[email protected]> > Fixes: 372d6d1b8ae3 ("PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation") > Signed-off-by: Leon Romanovsky <[email protected]> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2