[dpdk-dev] [PATCH 16/22] uio: Wrap call into try/except block
Narcisa Ana Maria Vasile
navasile at linux.microsoft.com
Fri Aug 14 01:21:39 CEST 2020
From: Narcisa Vasile <navasile at microsoft.com>
MmMapLockedPagesSpecifyCache can raise an exception when
it cannot map the specified pages.
Signed-off-by: Narcisa Vasile <navasile at microsoft.com>
Reported-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
---
kernel/windows/netuio/netuio_queue.c | 36 ++++++++++++++++++----------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c
index 9c7ff7d06..c2bc998dc 100644
--- a/kernel/windows/netuio/netuio_queue.c
+++ b/kernel/windows/netuio/netuio_queue.c
@@ -53,13 +53,18 @@ netuio_map_address_into_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdat
// Map the scratch memory regions to the user's process context
MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_seg.mdl);
- netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr =
- MmMapLockedPagesSpecifyCache(
- netuio_contextdata->dpdk_seg.mdl, UserMode, MmCached,
- NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute));
+ __try {
+ netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr =
+ MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_seg.mdl, UserMode,
+ MmCached, NULL, FALSE, NormalPagePriority);
- if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
+ if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr == NULL) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ goto end;
+ }
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER) {
+ status = GetExceptionCode();
goto end;
}
@@ -70,13 +75,18 @@ netuio_map_address_into_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdat
}
MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_hw[idx].mdl);
- netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr =
- MmMapLockedPagesSpecifyCache(
- netuio_contextdata->dpdk_hw[idx].mdl, UserMode, MmCached,
- NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute));
-
- if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
+ __try {
+ netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr =
+ MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_hw[idx].mdl, UserMode,
+ MmCached, NULL, FALSE, NormalPagePriority);
+
+ if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr == NULL) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ goto end;
+ }
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER) {
+ status = GetExceptionCode();
goto end;
}
}
--
2.23.0.vfs.1.1.63.g5a5ad7f
More information about the dev
mailing list