librte_pmd_fm10k: Set pointer to NULL after free
PATCH 1/1 librte_pmd_fm10k: Set pointer to NULL after free
It could be a potential not safe issue.
Signed-off-by Michael Qiu <[email protected]>
--- lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
lib/librte_pmd_fm10k/fm10k_ethdev.c +11 -3
@@ -142,9 +142,12 @@ rx_queue_free(struct fm10k_rx_queue *q)if (q) {PMD_INIT_LOG (DEBUG ,"Freeing rx queue %p" , q);rx_queue_clean (q); -if (q->sw_ring) +if (q->sw_ring) {rte_free (q->sw_ring); + q->sw_ring =NULL ; + }rte_free (q); + q =NULL ; } }
@@ -225,11 +228,16 @@ tx_queue_free(struct fm10k_tx_queue *q)if (q) {PMD_INIT_LOG (DEBUG ,"Freeing tx queue %p" , q);tx_queue_clean (q); -if (q->rs_tracker.list) +if (q->rs_tracker.list) {rte_free (q->rs_tracker.list); -if (q->sw_ring) + q->rs_tracker.list =NULL ; + } +if (q->sw_ring) {rte_free (q->sw_ring); + q->sw_ring =NULL ; + }rte_free (q); + q =NULL ; } }
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1425628607-1497-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Chen, Jing D
Acked-byQuoted 55 lines
-----Original Message-----
From: Qiu, Michael
Sent: Friday, March 06, 2015 3:57 PM
To: [email protected]
Cc: Chen, Jing D; Qiu, Michael
Subject: [PATCH]librte_pmd_fm10k: Set pointer to NULL after freeIt could be a potential not safe issue.
Signed-off-by Michael Qiu <[email protected]>--- lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)lib/librte_pmd_fm10k/fm10k_ethdev.c +11
-4@@ -142,9 +142,12 @@ rx_queue_free(struct fm10k_rx_queue *q)if (q) {PMD_INIT_LOG (DEBUG ,"Freeing rx queue %p" , q);rx_queue_clean (q); -if (q->sw_ring) +if (q->sw_ring) {rte_free (q->sw_ring); + q->sw_ring =NULL ; + }rte_free (q); + q =NULL ; } }@@ -225,11 +228,16 @@ tx_queue_free(struct fm10k_tx_queue *q)if (q) {PMD_INIT_LOG (DEBUG ,"Freeing tx queue %p" , q);tx_queue_clean (q); -if (q->rs_tracker.list) +if (q->rs_tracker.list) {rte_free (q->rs_tracker.list); -if (q->sw_ring) + q->rs_tracker.list =NULL ; + } +if (q->sw_ring) {rte_free (q->sw_ring); + q->sw_ring =NULL ; + }rte_free (q); + q =NULL ; } } --
Quoted 1 line
1.9.3
Acked-by Jing Chen <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 4341B239C0EFF9468EE453F9E9F4604D0169D833-E2R4CRU6q/[email protected]
Thomas Monjalon
AppliedQuoted 5 lines
Quoted 3 lines
It could be a potential not safe issue.
Signed-off-by Michael Qiu <[email protected]>Acked-by Jing Chen <[email protected]>
Applied, thanks