* [PATCH] librte_pmd_fm10k: Set pointer to NULL after free
@ 2015-03-06 7:56 Michael Qiu
[not found] ` <1425628607-1497-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Qiu @ 2015-03-06 7:56 UTC (permalink / raw)
To: dev-VfR2kkLFssw
It could be a potential not safe issue.
Signed-off-by: Michael Qiu <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c b/lib/librte_pmd_fm10k/fm10k_ethdev.c
index 07ea1e7..30962d3 100644
--- a/lib/librte_pmd_fm10k/fm10k_ethdev.c
+++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c
@@ -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;
}
}
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1425628607-1497-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] librte_pmd_fm10k: Set pointer to NULL after free [not found] ` <1425628607-1497-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2015-03-16 1:46 ` Chen, Jing D [not found] ` <4341B239C0EFF9468EE453F9E9F4604D0169D833-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Chen, Jing D @ 2015-03-16 1:46 UTC (permalink / raw) To: Qiu, Michael, dev-VfR2kkLFssw@public.gmane.org > -----Original Message----- > From: Qiu, Michael > Sent: Friday, March 06, 2015 3:57 PM > To: dev-VfR2kkLFssw@public.gmane.org > Cc: Chen, Jing D; Qiu, Michael > Subject: [PATCH] librte_pmd_fm10k: Set pointer to NULL after free > > It could be a potential not safe issue. > > Signed-off-by: Michael Qiu <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > --- > lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c > b/lib/librte_pmd_fm10k/fm10k_ethdev.c > index 07ea1e7..30962d3 100644 > --- a/lib/librte_pmd_fm10k/fm10k_ethdev.c > +++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c > @@ -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; > } > } > > -- > 1.9.3 Acked-by: Jing Chen <jing.d.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <4341B239C0EFF9468EE453F9E9F4604D0169D833-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* Re: [PATCH] librte_pmd_fm10k: Set pointer to NULL after free [not found] ` <4341B239C0EFF9468EE453F9E9F4604D0169D833-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2015-03-16 23:42 ` Thomas Monjalon 0 siblings, 0 replies; 3+ messages in thread From: Thomas Monjalon @ 2015-03-16 23:42 UTC (permalink / raw) To: Qiu, Michael; +Cc: dev-VfR2kkLFssw > > It could be a potential not safe issue. > > > > Signed-off-by: Michael Qiu <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > Acked-by: Jing Chen <jing.d.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Applied, thanks ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-16 23:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-06 7:56 [PATCH] librte_pmd_fm10k: Set pointer to NULL after free Michael Qiu
[not found] ` <1425628607-1497-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-16 1:46 ` Chen, Jing D
[not found] ` <4341B239C0EFF9468EE453F9E9F4604D0169D833-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-16 23:42 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox