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
| 1 | 1 | diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h | |
| 2 | 2 | index 1c39ab6..0e0107c 100644 | |
| 3 | 3 | --- a/sys/nfs41sys_driver.h | |
| 4 | 4 | +++ b/sys/nfs41sys_driver.h | |
| 5 | 5 | @@ -48,8 +48,10 @@ | |
| 6 | 6 | (POOL_FLAG_UNINITIALIZED|POOL_FLAG_CACHE_ALIGNED) | |
| 7 | 7 | ||
| 8 | 8 | #define RxAllocatePoolWithTag(rxallocpool, numbytes, tag) \ | |
| 9 | 9 | - ExAllocatePool2(((((rxallocpool) == NonPagedPoolNx)? \ | |
| 10 | 10 | - POOL_FLAG_NON_PAGED:POOL_FLAG_NON_PAGED_EXECUTE) | \ | |
| 11 | 11 | + ExAllocatePool2((( \ | |
| 12 | 12 | + ((rxallocpool) == PagedPool)?POOL_FLAG_PAGED: \ | |
| 13 | 13 | + (((rxallocpool) == NonPagedPoolNx)? \ | |
| 14 | 14 | + POOL_FLAG_NON_PAGED:POOL_FLAG_NON_PAGED_EXECUTE)) | \ | |
| 15 | 15 | RXALLOCATEPOOL_DEFAULT_ALLOCATEPOOL2FLAGS), \ | |
| 16 | 16 | (numbytes), (tag)) | |
| 17 | 17 | #endif /* EXALLOCATEPOOLWITHTAG_DEPRECATED */ | |
| 18 | 18 | diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c | |
| 19 | - | index 050819c..a1f5cc1 100644 | |
| 19 | + | index 050819c..b34a4a3 100644 | |
| 20 | 20 | --- a/sys/nfs41sys_readwrite.c | |
| 21 | 21 | +++ b/sys/nfs41sys_readwrite.c | |
| 22 | 22 | @@ -58,6 +58,7 @@ | |
| 23 | 23 | #include <winerror.h> | |
| 24 | 24 | ||
| 25 | 25 | #include <Ntstrsafe.h> | |
| 26 | 26 | +#include <stdbool.h> | |
| 27 | 27 | ||
| 28 | 28 | #include "nfs41sys_buildconfig.h" | |
| 29 | 29 | ||
| 30 | 30 | @@ -333,7 +334,7 @@ NTSTATUS nfs41_Write( | |
| 31 | 31 | IN OUT PRX_CONTEXT RxContext) | |
| 32 | 32 | { | |
| 33 | 33 | NTSTATUS status = STATUS_INSUFFICIENT_RESOURCES; | |
| 34 | 34 | - nfs41_updowncall_entry *entry; | |
| 35 | 35 | + nfs41_updowncall_entry *entry = NULL; | |
| 36 | 36 | BOOLEAN async = FALSE; | |
| 37 | 37 | PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext; | |
| 38 | 38 | __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen; | |
| 39 | 39 | @@ -344,6 +345,11 @@ NTSTATUS nfs41_Write( | |
| 40 | 40 | __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb); | |
| 41 | 41 | __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx); | |
| 42 | 42 | DWORD io_delay; | |
| 43 | 43 | +#if 1 | |
| 44 | 44 | + void *userbuffer_mem = NULL; | |
| 45 | + | + PMDL userbuffer_mdl = NULL; | |
| 45 | 46 | + PVOID UserBuffer = NULL; | |
| 47 | 47 | +#endif | |
| 48 | 48 | #ifdef ENABLE_TIMINGS | |
| 49 | 49 | LARGE_INTEGER t1, t2; | |
| 50 | 50 | t1 = KeQueryPerformanceCounter(NULL); | |
| 51 | - | @@ -362,9 +368,66 @@ NTSTATUS nfs41_Write( | |
| 51 | + | @@ -362,9 +368,43 @@ NTSTATUS nfs41_Write( | |
| 52 | 52 | pNetRootContext->nfs41d_version, SrvOpen->pAlreadyPrefixedName, &entry); | |
| 53 | 53 | if (status) goto out; | |
| 54 | 54 | ||
| 55 | 55 | +#if 1 | |
| 56 | 56 | + userbuffer_mem = RxAllocatePoolWithTag(NonPagedPoolNx, | |
| 57 | 57 | + LowIoContext->ParamsFor.ReadWrite.ByteCount, | |
| 58 | 58 | + NFS41_MM_POOLTAG_DOWN); | |
| 59 | 59 | + if (userbuffer_mem == NULL) { | |
| 60 | 60 | + status = STATUS_NO_MEMORY; | |
| 61 | 61 | + goto out; | |
| 62 | 62 | + } | |
| 63 | 63 | + | |
| 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; | |
| 68 | 68 | + } | |
| 70 | 69 | + | |
| 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; | |
| 84 | 75 | + goto out; | |
| 85 | 76 | + } | |
| 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.
nrubsig.kpaste.net RSS