pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS

Difference between
modified post 817e by Anonymous on Mon 16th Dec 2024 17:51
original post dcffdda by Anonymous on Mon 16th Dec 2024 16:30
Download diff
Show old version | new version | both versions

    
11
diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
22
index 1c39ab6..0e0107c 100644
33
--- a/sys/nfs41sys_driver.h
44
+++ b/sys/nfs41sys_driver.h
55
@@ -48,8 +48,10 @@
66
     (POOL_FLAG_UNINITIALIZED|POOL_FLAG_CACHE_ALIGNED)
77
88
 #define RxAllocatePoolWithTag(rxallocpool, numbytes, tag) \
99
-    ExAllocatePool2(((((rxallocpool) == NonPagedPoolNx)? \
1010
-            POOL_FLAG_NON_PAGED:POOL_FLAG_NON_PAGED_EXECUTE) | \
1111
+    ExAllocatePool2((( \
1212
+            ((rxallocpool) == PagedPool)?POOL_FLAG_PAGED: \
1313
+                (((rxallocpool) == NonPagedPoolNx)? \
1414
+                    POOL_FLAG_NON_PAGED:POOL_FLAG_NON_PAGED_EXECUTE)) | \
1515
             RXALLOCATEPOOL_DEFAULT_ALLOCATEPOOL2FLAGS), \
1616
         (numbytes), (tag))
1717
 #endif /* EXALLOCATEPOOLWITHTAG_DEPRECATED */
1818
diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
19-
index 050819c..a1f5cc1 100644
19+
index 050819c..b34a4a3 100644
2020
--- a/sys/nfs41sys_readwrite.c
2121
+++ b/sys/nfs41sys_readwrite.c
2222
@@ -58,6 +58,7 @@
2323
 #include <winerror.h>
2424
2525
 #include <Ntstrsafe.h>
2626
+#include <stdbool.h>
2727
2828
 #include "nfs41sys_buildconfig.h"
2929
3030
@@ -333,7 +334,7 @@ NTSTATUS nfs41_Write(
3131
     IN OUT PRX_CONTEXT RxContext)
3232
 {
3333
     NTSTATUS status = STATUS_INSUFFICIENT_RESOURCES;
3434
-    nfs41_updowncall_entry *entry;
3535
+    nfs41_updowncall_entry *entry = NULL;
3636
     BOOLEAN async = FALSE;
3737
     PLOWIO_CONTEXT LowIoContext  = &RxContext->LowIoContext;
3838
     __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
3939
@@ -344,6 +345,11 @@ NTSTATUS nfs41_Write(
4040
     __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
4141
     __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
4242
     DWORD io_delay;
4343
+#if 1
4444
+    void *userbuffer_mem = NULL;
45+
+    PMDL userbuffer_mdl = NULL;
4546
+    PVOID UserBuffer = NULL;
4747
+#endif
4848
 #ifdef ENABLE_TIMINGS
4949
     LARGE_INTEGER t1, t2;
5050
     t1 = KeQueryPerformanceCounter(NULL);
51-
@@ -362,9 +368,66 @@ NTSTATUS nfs41_Write(
51+
@@ -362,9 +368,43 @@ NTSTATUS nfs41_Write(
5252
         pNetRootContext->nfs41d_version, SrvOpen->pAlreadyPrefixedName, &entry);
5353
     if (status) goto out;
5454
5555
+#if 1
5656
+    userbuffer_mem = RxAllocatePoolWithTag(NonPagedPoolNx,
5757
+        LowIoContext->ParamsFor.ReadWrite.ByteCount,
5858
+        NFS41_MM_POOLTAG_DOWN);
5959
+    if (userbuffer_mem == NULL) {
6060
+        status = STATUS_NO_MEMORY;
6161
+        goto out;
6262
+    }
6363
+
64-
+#if 1
64+
+    UserBuffer = RxLowIoGetBufferAddress(RxContext);
65-
+    if (!RxLowIoIsMdlLocked(LowIoContext->ParamsFor.ReadWrite.Buffer)) {
65+
+    if (UserBuffer == NULL) {
66-
+        MmProbeAndLockPages(LowIoContext->ParamsFor.ReadWrite.Buffer, KernelMode, IoModifyAccess);
66+
+        status = STATUS_NO_MEMORY;
67-
+        mdl_locked = true;
67+
+        goto out;
6868
+    }
7069
+
71-
+#if 1
70+
+    userbuffer_mdl = IoAllocateMdl(userbuffer_mem,
72-
+    __try {
71+
+        LowIoContext->ParamsFor.ReadWrite.ByteCount,
73-
+        UserBuffer = MmMapLockedPagesSpecifyCache(
72+
+        FALSE, FALSE, NULL);
74-
+            LowIoContext->ParamsFor.ReadWrite.Buffer,
73+
+    if (userbuffer_mdl == NULL) {
75-
+            KernelMode, MmCached, NULL, FALSE,
74+
+        status = STATUS_NO_MEMORY;
8475
+        goto out;
8576
+    }
86-
+#else
87-
+    UserBuffer = RxLowIoGetBufferAddress(RxContext);
88-
+#endif
89-
+    if (UserBuffer == NULL) {
90-
+        status = STATUS_NO_MEMORY;
91-
+        goto out;
92-
+    }
77+
+

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at