[NPFS]
authorThomas Faber <thomas.faber@reactos.org>
Mon, 20 Oct 2014 08:08:50 +0000 (08:08 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 20 Oct 2014 08:08:50 +0000 (08:08 +0000)
- Correctly interpret SeCreateClientSecurity return value in NpInitializeSecurity
- Always charge quota when allocating client context
- Specify explicit 0 tag when freeing allocations with unknown pool tag
- Misc readability fixes

svn path=/trunk/; revision=64839

reactos/drivers/filesystems/npfs/create.c
reactos/drivers/filesystems/npfs/secursup.c
reactos/drivers/filesystems/npfs/seinfo.c

index 4be56c6..04fdfe8 100644 (file)
@@ -736,12 +736,12 @@ NpCreateNewNamedPipe(IN PNP_DCB Dcb,
     }
 
     SecurityContext = &AccessState->SubjectSecurityContext;
-    SeLockSubjectContext(&AccessState->SubjectSecurityContext);
+    SeLockSubjectContext(SecurityContext);
 
-    Status = SeAssignSecurity(0,
+    Status = SeAssignSecurity(NULL,
                               AccessState->SecurityDescriptor,
                               &SecurityDescriptor,
-                              0,
+                              FALSE,
                               SecurityContext,
                               IoGetFileObjectGenericMapping(),
                               PagedPool);
@@ -756,7 +756,7 @@ NpCreateNewNamedPipe(IN PNP_DCB Dcb,
     Status = ObLogSecurityDescriptor(SecurityDescriptor,
                                      &CachedSecurityDescriptor,
                                      1);
-    ExFreePool(SecurityDescriptor);
+    ExFreePoolWithTag(SecurityDescriptor, 0);
 
     if (!NT_SUCCESS(Status))
     {
index f2a99b4..60581e1 100644 (file)
@@ -108,15 +108,19 @@ NpInitializeSecurity(IN PNP_CCB Ccb,
         return Status;
     }
 
-    ClientContext = ExAllocatePoolWithTag(PagedPool, sizeof(*ClientContext), NPFS_CLIENT_SEC_CTX_TAG);
+    ClientContext = ExAllocatePoolWithQuotaTag(PagedPool | POOL_QUOTA_FAIL_INSTEAD_OF_RAISE,
+                                               sizeof(*ClientContext),
+                                               NPFS_CLIENT_SEC_CTX_TAG);
     Ccb->ClientContext = ClientContext;
     if (!ClientContext) return STATUS_INSUFFICIENT_RESOURCES;
 
     Status = SeCreateClientSecurity(Thread, &Ccb->ClientQos, 0, ClientContext);
-    if (!NT_SUCCESS(Status)) return Status;
+    if (!NT_SUCCESS(Status))
+    {
+        ExFreePool(Ccb->ClientContext);
+        Ccb->ClientContext = NULL;
+    }
 
-    ExFreePool(Ccb->ClientContext);
-    Ccb->ClientContext = NULL;
     return Status;
 }
 
index 546388d..1678ef2 100644 (file)
@@ -85,7 +85,8 @@ NpCommonSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject,
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ObLogSecurityDescriptor(TempSecurityDescriptor, &NewSecurityDescriptor, 1);
-    ExFreePool(TempSecurityDescriptor);
+    ASSERT(TempSecurityDescriptor != OldSecurityDescriptor);
+    ExFreePoolWithTag(TempSecurityDescriptor, 0);
 
     if (!NT_SUCCESS(Status)) return Status;