History

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.

Kishon Vijay Abraham I committed 6 years ago

Commit 04e046c1 parent 3d3248d2 files · +11 −2Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/pci-epc.h+3−0
@@ -71,6 +71,7 @@ struct pci_epc_ops { · 70 unmodified lines
71 * @bitmap: bitmap to manage the PCI address space71 * @bitmap: bitmap to manage the PCI address space
72 * @pages: number of bits representing the address region72 * @pages: number of bits representing the address region
73 * @page_size: size of each page73 * @page_size: size of each page
74 * @lock: mutex to protect bitmap
74 */75 */
75struct pci_epc_mem {76struct pci_epc_mem {
76 phys_addr_t phys_base;77 phys_addr_t phys_base;
@@ -78,6 +79,8 @@ struct pci_epc_mem { · 1 unmodified line
78 unsigned long *bitmap;79 unsigned long *bitmap;
79 size_t page_size;80 size_t page_size;
80 int pages;81 int pages;
82 /* mutex to protect against concurrent access for memory allocation*/
83 struct mutex lock;
81};84};
82 85
83/**86/**