summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2023-02-22 13:47:26 -0600
committerBjorn Helgaas <bhelgaas@google.com>2023-02-22 13:47:26 -0600
commit7260675a52a67f3c44036306bf25f6947c294a02 (patch)
treef0415c0586610078f13823baded1de1e75042c98 /drivers/pci
parent881766fe0d4a8db9d885864afdfe44a5ea8d2c53 (diff)
parent6606f4c3c48c7a75b13816266d3ea562eeec0b44 (diff)
Merge branch 'pci/p2pdma'
- Annotate RCU dereference (Logan Gunthorpe) * pci/p2pdma: PCI/P2PDMA: Annotate RCU dereference
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/p2pdma.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 86812d2073ea..9e8205572830 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -194,11 +194,13 @@ static const struct attribute_group p2pmem_group = {
static void p2pdma_page_free(struct page *page)
{
struct pci_p2pdma_pagemap *pgmap = to_p2p_pgmap(page->pgmap);
+ /* safe to dereference while a reference is held to the percpu ref */
+ struct pci_p2pdma *p2pdma =
+ rcu_dereference_protected(pgmap->provider->p2pdma, 1);
struct percpu_ref *ref;
- gen_pool_free_owner(pgmap->provider->p2pdma->pool,
- (uintptr_t)page_to_virt(page), PAGE_SIZE,
- (void **)&ref);
+ gen_pool_free_owner(p2pdma->pool, (uintptr_t)page_to_virt(page),
+ PAGE_SIZE, (void **)&ref);
percpu_ref_put(ref);
}