diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2020-02-24 12:53:36 +0300 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2020-02-24 13:13:48 +0300 |
commit | 04e046ca57ebed3943422dee10eec9e73aec081e (patch) | |
tree | 507d2a04ccefe9eb00f775f9fd408ba966a0f57e /include/linux/pci-epc.h | |
parent | 3d3248dbd018502f654064c78efcd2e165ab3486 (diff) | |
download | linux-04e046ca57ebed3943422dee10eec9e73aec081e.tar.xz |
PCI: endpoint: Fix for concurrent memory allocation in OB address region
pci-epc-mem uses a bitmap to manage the Endpoint outbound (OB) address
region. This address region will be shared by multiple endpoint
functions (in the case of multi function endpoint) and it has to be
protected from concurrent access to avoid updating an inconsistent state.
Use a mutex to protect bitmap updates to prevent the memory
allocation API from returning incorrect addresses.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: stable@vger.kernel.org # v4.14+
Diffstat (limited to 'include/linux/pci-epc.h')
-rw-r--r-- | include/linux/pci-epc.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index 9dd60f2e9705..4e3e527c49d1 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -71,6 +71,7 @@ struct pci_epc_ops { * @bitmap: bitmap to manage the PCI address space * @pages: number of bits representing the address region * @page_size: size of each page + * @lock: mutex to protect bitmap */ struct pci_epc_mem { phys_addr_t phys_base; @@ -78,6 +79,8 @@ struct pci_epc_mem { unsigned long *bitmap; size_t page_size; int pages; + /* mutex to protect against concurrent access for memory allocation*/ + struct mutex lock; }; /** |