lib/distributor: fix segfaults in flush
PATCH 1/1 lib/distributor: fix segfaults in flush
A segfault when flushing packets has been revealed by further testing when using distributor in single packet mode. This patch resolves that.
--- lib/librte_distributor/rte_distributor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/librte_distributor/rte_distributor.c +4 -1
@@ -555,7 +555,7 @@ total_outstanding(const struct rte_distributor *d)int rte_distributor_flush_v1705 (struct rte_distributor *d) { -const unsigned int flushed =total_outstanding (d); +unsigned int flushed;unsigned int wkr;if (d->alg_type ==RTE_DIST_ALG_SINGLE ) {
@@ -563,6 +563,8 @@ rte_distributor_flush_v1705(struct rte_distributor *d)return rte_distributor_flush_v20 (d->d_v20); } + flushed =total_outstanding (d); +while (total_outstanding (d) >0 )rte_distributor_process (d,NULL ,0 );
@@ -590,6 +592,7 @@ rte_distributor_clear_returns_v1705(struct rte_distributor *d)if (d->alg_type ==RTE_DIST_ALG_SINGLE ) {/* Call the old API */ rte_distributor_clear_returns_v20 (d->d_v20); +return ; }/* throw away returns, so workers can exit */
Signature · 1 line
2.7.4
Quoted 7 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of David Hunt
Sent: Thursday, April 13, 2017 4:36 PM
To: [email protected]
Cc: Hunt, David <[email protected]>
Subject: [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush
Quoted 8 lines
A segfault when flushing packets has been revealed by further testing when using distributor in single packet mode. This patch resolves that.
Fixes 775003ad2f96 ("distributor: add new burst-capable library")Reported-by Yong Liu <[email protected]>Signed-off-by David Hunt <[email protected]>---
Quoted 7 lines · David Hunt
A segfault when flushing packets has been revealed by further testing when using distributor in single packet mode. This patch resolves that.
Fixes 775003ad2f96 ("distributor: add new burst-capable library")Reported-by Yong Liu <[email protected]>Signed-off-by David Hunt <[email protected]>
Hi Dave,
I think you could do with giving more details in the commit messaage on how/why the error occurs and how exactly this patch fixes it.
With expanded commit log message:
PATCH v2 1/1 lib/distributor: fix segfaults in flush
In reply to David HuntOccasionally, the distributor single-packet-at-a-time mode will segfault because it inadvertently calls some burst mode code when flushing packets.
This patch ensures that only the v20 (single mode) codepath is used, and returns without falling through to the burst mode code.
v2: Extented commit message. Patch remains the same.
--- lib/librte_distributor/rte_distributor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/librte_distributor/rte_distributor.c +4 -1
@@ -555,7 +555,7 @@ total_outstanding(const struct rte_distributor *d)int rte_distributor_flush_v1705 (struct rte_distributor *d) { -const unsigned int flushed =total_outstanding (d); +unsigned int flushed;unsigned int wkr;if (d->alg_type ==RTE_DIST_ALG_SINGLE ) {
@@ -563,6 +563,8 @@ rte_distributor_flush_v1705(struct rte_distributor *d)return rte_distributor_flush_v20 (d->d_v20); } + flushed =total_outstanding (d); +while (total_outstanding (d) >0 )rte_distributor_process (d,NULL ,0 );
@@ -590,6 +592,7 @@ rte_distributor_clear_returns_v1705(struct rte_distributor *d)if (d->alg_type ==RTE_DIST_ALG_SINGLE ) {/* Call the old API */ rte_distributor_clear_returns_v20 (d->d_v20); +return ; }/* throw away returns, so workers can exit */
Signature · 1 line
2.7.4
Thomas Monjalon
Applied14/04/2017 10:59, David Hunt:
Quoted 7 lines
Occasionally, the distributor single-packet-at-a-time mode will segfault because it inadvertently calls some burst mode code when flushing packets.
This patch ensures that only the v20 (single mode) codepath is used, and returns without falling through to the burst mode code.
Quoted 7 lines
Fixes 775003ad2f96 ("distributor: add new burst-capable library")v2: Extented commit message. Patch remains the same.
Signed-off-by David Hunt <[email protected]>Tested-by Yong Liu <[email protected]>Acked-by Bruce Richardson <[email protected]>
Applied, thanks