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 EF897A04F6 for ; Mon, 6 Jan 2020 21:56:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C33C1D6EE; Mon, 6 Jan 2020 21:56:06 +0100 (CET) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 990381D6EE for ; Mon, 6 Jan 2020 21:56:05 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id k25so27392634pgt.7 for ; Mon, 06 Jan 2020 12:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JGYIgq+uwfpes47A1SXtgbwDNsKAt5Xi3KqQJ3KrWpM=; b=JCzs4Uz/gfQ0VvF/7sS8akRA9vXywgmVBeX1YPfDXnjtBN93zlA2zGYC9IKUZcSWXj sD7fGB0W0N1+ZOAbW+Pr7+y23a+1CVCo6NJLOUaCmAWSQUhviiZW+MvvZ6n88mUHKzCi 49uLgO10Kk70S07x+tAaKA6gRQuQES1oBPFLWjwS4KclH4I8bA48kOUSoIaIax9YKEaR 4daortkTroN7EtfkW4xZLbT/y1u1kydtgkmuq3a85uJgrULTnh3OsIb8s5ZJc2aX5Xs4 9t4VStCT/0vn6Zf+pm4ANfCqdm5022cO3LFXPSPpn6r+YSSrurJKYJWh4VLhcTXUvXXX Korg== 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=JGYIgq+uwfpes47A1SXtgbwDNsKAt5Xi3KqQJ3KrWpM=; b=Kk+5to3V20SUPSMs3HNmRaEZxsOdd65qXcVa3NibzOIg1IJ7KmUu4sfRV96c108nry w0tYz8/9QHcUsdo4TCqz2A5CL1daTJn/2lVdfCgx3sdxqqjG6RcWP5NtUOYC0yDG2w/9 RQUySgl5Qr91frCJvtsa2Fzf8UDpZ9Yxf/bGapBysYabsUqmKdJTsxNR5qL9c6vX6v3w MVsG69604LHVk4NJ/8iW5Se/rhlmNndMq06cEhpSotbqLJPrxhNklhlnt5WhqHCsQIpS XOrGLlotYz/XY2roBO0S/c5OKHgKmhwkFoY5R5gn6+a9wtB6q/eozSHrpZQzBA+iTfDg egLg== X-Gm-Message-State: APjAAAUhIUH1LO3NV3Xi21z0h9yrm7M30thLlk+zUDutXEQ6aV7mMGyX Gf0+HrrvwoGRaco5162tIpJr2w== X-Google-Smtp-Source: APXvYqzNy5V7dJA4psrSgnUpt+sAVD9CTy43ogvGMw52BI9Go5sX7KdLWyiLvy+XCTakmDE56ZrN7w== X-Received: by 2002:aa7:9484:: with SMTP id z4mr108776893pfk.88.1578344164513; Mon, 06 Jan 2020 12:56:04 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id x132sm77652555pfc.148.2020.01.06.12.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:56:03 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , anatoly.burakov@intel.com, stable@dpdk.org Date: Mon, 6 Jan 2020 12:55:53 -0800 Message-Id: <20200106205553.3696-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] mem: fix incorrect munmap in error unwind X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The loop to unwind existing mmaps was only unmapping the first segment. Also, remove obvious redundant assignment. Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists") Cc: anatoly.burakov@intel.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- lib/librte_eal/linux/eal/eal_memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_memory.c b/lib/librte_eal/linux/eal/eal_memory.c index 43e4ffc757bd..cf5b2433614b 100644 --- a/lib/librte_eal/linux/eal/eal_memory.c +++ b/lib/librte_eal/linux/eal/eal_memory.c @@ -1967,9 +1967,8 @@ eal_legacy_hugepage_attach(void) close(fd); error: /* map all segments into memory to make sure we get the addrs */ - cur_seg = 0; for (cur_seg = 0; cur_seg < i; cur_seg++) { - struct hugepage_file *hf = &hp[i]; + struct hugepage_file *hf = &hp[cur_seg]; size_t map_sz = hf->size; void *map_addr = hf->final_va; -- 2.20.1