From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF434A04B1; Fri, 14 Aug 2020 01:25:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B11CB1C1DC; Fri, 14 Aug 2020 01:23:08 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id BD9081C0D5 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 3D59520B476E; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3D59520B476E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=nx76Tcz5cHRIkPOyvXwLEjE8DjreYmPGtBVLHUeNEag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLTHjQfJwdnCxU8rXnRrRbUFB/p/FmnVjmjQQs4POyI+gXY6XWsBjRnB/yzM5Rv46 aGSgO9kc359s05Ez/mbvaglQhRYX0uiKoV1xDbCIwY9vMigh/RDJrXgEpHd/4vMXh3 BlhQL4pqYGLv28wGoHwAXYa4ep7Rv6lb/Sy75UaY= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:39 -0700 Message-Id: <1597360905-74106-17-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 16/22] uio: Wrap call into try/except block X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile MmMapLockedPagesSpecifyCache can raise an exception when it cannot map the specified pages. Signed-off-by: Narcisa Vasile Reported-by: Dmitry Kozlyuk --- 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