fbarray: fix fbarray destruction

Message ID a7678616c14055fb2ed3d51aa48f25f1201ce930.1562680812.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series fbarray: fix fbarray destruction |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail apply issues

Commit Message

Burakov, Anatoly July 9, 2019, 2 p.m. UTC
  Currently, when fbarray is destroyed, the fbarray structure is not
zeroed out, which leads to stale data being there and confusing
secondary process init in legacy mem mode. Fix it by always
memsetting the fbarray to zero when destroying it.

Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/common/eal_common_fbarray.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Thomas Monjalon July 10, 2019, 9:26 p.m. UTC | #1
09/07/2019 16:00, Anatoly Burakov:
> Currently, when fbarray is destroyed, the fbarray structure is not
> zeroed out, which leads to stale data being there and confusing
> secondary process init in legacy mem mode. Fix it by always
> memsetting the fbarray to zero when destroying it.
> 
> Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index b7ddb66e9..1312f936b 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -1055,6 +1055,9 @@  rte_fbarray_destroy(struct rte_fbarray *arr)
 	TAILQ_REMOVE(&mem_area_tailq, tmp, next);
 	free(tmp);
 	ret = 0;
+
+	/* reset the fbarray structure */
+	memset(arr, 0, sizeof(*arr));
 out:
 	rte_spinlock_unlock(&mem_area_lock);
 	return ret;