summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2020-02-24 12:53:36 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-17 11:48:46 +0300
commit9ffaeee7bce48dfd454cdbfc3f9269962fd5a322 (patch)
tree2a0eb9e7d632f7d236ac5a0ffb03c40c9b8b0804 /include
parentd2345d1231d80ecbea5fb764eb43123440861462 (diff)
downloadlinux-9ffaeee7bce48dfd454cdbfc3f9269962fd5a322.tar.xz
PCI: endpoint: Fix for concurrent memory allocation in OB address region
commit 04e046ca57ebed3943422dee10eec9e73aec081e upstream. 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+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/pci-epc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
index 37dab8116901..931fda3e5e0d 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -69,6 +69,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;
@@ -76,6 +77,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;
};
/**