]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
VMCI Handle array should allocate mem atomic.
authorVMware, Inc <>
Wed, 20 Jan 2010 21:21:26 +0000 (13:21 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Wed, 20 Jan 2010 21:21:26 +0000 (13:21 -0800)
The VMCI handle arrays are usually appended to and copied
while holding spinlocks. As these operations may/will result
in memory being allocated, the memory allocations should be
atomic.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/vmci/vmci_handle_array.h

index 36172f1fa0120f4be9274fabe8c5e7ac3e58ce9b..0f4c6fc724e0d3b69d82da9904a64ef9d92e2c55 100644 (file)
@@ -144,8 +144,8 @@ VMCIHandleArray_AppendEntry(VMCIHandleArray **arrayPtr,
       uint32 arraySize = sizeof array->capacity + sizeof array->size +
          array->capacity * sizeof(VMCIHandle);
       VMCIHandleArray *newArray = (VMCIHandleArray *)
-             VMCI_AllocKernelMem(arraySize + array->capacity * sizeof(VMCIHandle),
-                             VMCI_MEMORY_NONPAGED);
+         VMCI_AllocKernelMem(arraySize + array->capacity * sizeof(VMCIHandle),
+                             VMCI_MEMORY_NONPAGED | VMCI_MEMORY_ATOMIC);
       if (newArray == NULL) {
          return;
       }
@@ -331,7 +331,8 @@ VMCIHandleArray_GetCopy(const VMCIHandleArray *array)
    arrayCopy = (VMCIHandleArray *)VMCI_AllocKernelMem(sizeof array->capacity + 
                                                       sizeof array->size +
                                                       array->size * sizeof(VMCIHandle),
-                                                      VMCI_MEMORY_NONPAGED);
+                                                      VMCI_MEMORY_NONPAGED |
+                                                         VMCI_MEMORY_ATOMIC);
    if (arrayCopy != NULL) {
       memcpy(&arrayCopy->size, &array->size,
              sizeof array->size + array->size * sizeof(VMCIHandle));