From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED470A0547; Fri, 9 Apr 2021 19:16:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7354B1410F5; Fri, 9 Apr 2021 19:16:40 +0200 (CEST) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mails.dpdk.org (Postfix) with ESMTP id 763F11410EC for ; Fri, 9 Apr 2021 19:16:39 +0200 (CEST) Received: by mail-lj1-f181.google.com with SMTP id z8so7298222ljm.12 for ; Fri, 09 Apr 2021 10:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jMI10Of4C+lxDTV93uuMOL9jSdfLHiOnMKdDVL0w1cg=; b=jWbXAggNv//qy/awKuN72Du39o0LLznGxCb3J14NVSVW2Sh/x+IZ3dTrQmxT9Q3RaC 7Li5g+6aQ3FKGmt+3dwh6GWdgasmEAvaQJJfihuG5fId8RekJfRO1eSk1tPdoBRFEOH2 cJUvU7mj0fzGD1F5XDFsGgo8Gzpct1HCGTsYFYQMcuS+yefF5Wj0PNBSl8whfh4o4ALN vtoKtn3iyYMktbZ5I5uKmIgLrNhteGvv4lIecrYLY9OPdz/4WIxOr+1YWGdx6Wy9LWQZ RgShOqOzKjnMs8tj0kMQQXZPI8FARSlV218D9f6rSmLqdvgYup+xZYsYuE0KDInFRh8J thwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jMI10Of4C+lxDTV93uuMOL9jSdfLHiOnMKdDVL0w1cg=; b=SCCdna8K9Y+aB1DE9oQysytvohcp4iTHdnxzny9FLIM1Vb/PwO2BHw6yjeHpX7Y10k DTCwigbajnRuOW+T5VvN3BQuE81AL1oelT+4hv7rjJd2Me040gUvgX1kpvoK3khnO6GG Ut9p2CMKZxcTiUYlj63PMlbtV8Iq9N+9H3m6Yig6ZBvk/M9eIunFRfyCc+y5fC5qC4uZ rLQhfLDx7kO5/y0AAXp9ziDm8yf3S10c0xKoUs7dKiTBVeM8QtSAxY0pijbHgySKNEKt XeiOitO8NJYCXNNSsWQdmLIatXfLhptzQb/lzpnZJiaVbzjXyuXW/n1rAAQtzu0HZDZC SLHg== X-Gm-Message-State: AOAM531aKrpHaKPDuUSiDxyu6DK3Py+/NadEC/RlEbhg2O+TJau0OyTb W2BxlKIlYBPH6YoHF1Q8kTZcIl0n5KHYAoh2 X-Google-Smtp-Source: ABdhPJz1/d7O8uN4B+pzaH0qP29nUoDcTnRR2CVnmLry27Fd9owjk8og+sgBENeYRAaDzVrS4U4BJg== X-Received: by 2002:a2e:7d03:: with SMTP id y3mr10202478ljc.0.1617988598673; Fri, 09 Apr 2021 10:16:38 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id v9sm60325ljk.38.2021.04.09.10.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 10:16:38 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Anatoly Burakov , David Marchand Date: Fri, 9 Apr 2021 20:16:31 +0300 Message-Id: <20210409171631.18219-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.29.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] mem: fix cleanup after incomplete initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" In case of EAL initialization failure rte_eal_memory_detach() may be called before mapping memory configuration, which in this case points to the static structure. Attempt to unmap it yields error: EAL: Could not unmap shared memory config: Invalid argument Skip unmapping memory configuration if it's not yet shared. Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup") Cc: Anatoly Burakov Reported-by: David Marchand Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/common/eal_common_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c index 2581dd5f58..f83b75092e 100644 --- a/lib/librte_eal/common/eal_common_memory.c +++ b/lib/librte_eal/common/eal_common_memory.c @@ -1055,7 +1055,7 @@ rte_eal_memory_detach(void) * config - we can't zero it out because it might still be referenced * by other processes. */ - if (internal_conf->no_shconf == 0) { + if (internal_conf->no_shconf == 0 && mcfg->mem_cfg_addr != 0) { if (rte_mem_unmap(mcfg, RTE_ALIGN(sizeof(*mcfg), page_sz)) != 0) RTE_LOG(ERR, EAL, "Could not unmap shared memory config: %s\n", rte_strerror(rte_errno)); -- 2.29.3