mem: fix index for unmapping segments on failure
authorAnatoly Burakov <anatoly.burakov@intel.com>
Thu, 3 May 2018 10:11:25 +0000 (11:11 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 14 May 2018 01:15:33 +0000 (03:15 +0200)
Segment index was calculated incorrectly, causing free_seg to
attempt to free segments that do not exist.

Fixes: a5ff05d60fc5 ("mem: support unmapping pages at runtime")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Yong Liu <yong.liu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_eal/linuxapp/eal/eal_memalloc.c

index ace2bcf..f687c4c 100644 (file)
@@ -735,8 +735,7 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg)
                                                &cur_msl->memseg_arr;
 
                                tmp = rte_fbarray_get(arr, j);
-                               if (free_seg(tmp, wa->hi, msl_idx,
-                                               start_idx + j)) {
+                               if (free_seg(tmp, wa->hi, msl_idx, j)) {
                                        RTE_LOG(ERR, EAL, "Cannot free page\n");
                                        continue;
                                }