[dpdk-dev,1/3] mem: fix index for unmapping segments on failure

Message ID 556d606e3af8ab32e920611d166a0154e472fe25.1525342009.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anatoly Burakov May 3, 2018, 10:11 a.m. UTC
  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")
Cc: anatoly.burakov@intel.com

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_memalloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Marvin Liu May 4, 2018, 8:13 a.m. UTC | #1
Tested-by: Marvin Liu <yong.liu@intel.com>

> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Thursday, May 03, 2018 6:11 PM
> To: dev@dpdk.org
> Cc: Liu, Yong <yong.liu@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>
> Subject: [PATCH 1/3] mem: fix index for unmapping segments on failure
> 
> 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")
> Cc: anatoly.burakov@intel.com
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_memalloc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c
> b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
> index 360d8f7..c441c89 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
> @@ -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;
>  				}
> --
> 2.7.4
  
Ananyev, Konstantin May 10, 2018, 5:07 p.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov
> Sent: Thursday, May 3, 2018 11:11 AM
> To: dev@dpdk.org
> Cc: Liu, Yong <yong.liu@intel.com>; Burakov, Anatoly <anatoly.burakov@intel.com>
> Subject: [dpdk-dev] [PATCH 1/3] mem: fix index for unmapping segments on failure
> 
> 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")
> Cc: anatoly.burakov@intel.com
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
  
Thomas Monjalon May 14, 2018, 1:18 a.m. UTC | #3
> > 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")
> > Cc: anatoly.burakov@intel.com
> > 
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Series applied, thanks
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
index 360d8f7..c441c89 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c
@@ -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;
 				}