[dpdk-stable] patch 'examples/bond: fix crash when there is no active slave' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Fri Dec 14 18:51:47 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/18/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From f70ae36fa1ff238804ca8193f43559788a14b398 Mon Sep 17 00:00:00 2001
From: Radu Nicolau <radu.nicolau at intel.com>
Date: Wed, 14 Nov 2018 12:19:09 +0000
Subject: [PATCH] examples/bond: fix crash when there is no active slave

[ upstream commit 292fdb76024fce3263e3c33009d37f46c10eddc5 ]

If bond_ethdev_rx_burst() called more times with no active slaves
the active slave index will point out of bounds, resulting in a
segfault.
The configured slaves needs to be checked, and if none became active
there is no point going further.

Do not start the packet processing threads until all configured
slaves become active.

Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")

Signed-off-by: Radu Nicolau <radu.nicolau at intel.com>
Acked-by: Chas Williams <chas3 at att.com>
---
 examples/bond/main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 23d0981ab..314d85747 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -222,4 +222,5 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 	struct rte_eth_txconf txq_conf;
 	struct rte_eth_conf local_port_conf = port_conf;
+	uint16_t wait_counter = 20;
 
 	retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ALB,
@@ -276,4 +277,18 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 		rte_exit(retval, "Start port %d failed (res=%d)", BOND_PORT, retval);
 
+	printf("Waiting for slaves to become active...");
+	while (wait_counter) {
+		uint16_t act_slaves[16] = {0};
+		if (rte_eth_bond_active_slaves_get(BOND_PORT, act_slaves, 16) ==
+				slaves_count) {
+			printf("\n");
+			break;
+		}
+		sleep(1);
+		printf("...");
+		if (--wait_counter == 0)
+			rte_exit(-1, "\nFailed to activate slaves\n");
+	}
+
 	rte_eth_promiscuous_enable(BOND_PORT);
 
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-12-14 17:49:47.787217930 +0000
+++ 0003-examples-bond-fix-crash-when-there-is-no-active-slav.patch	2018-12-14 17:49:47.000000000 +0000
@@ -1,8 +1,10 @@
-From 292fdb76024fce3263e3c33009d37f46c10eddc5 Mon Sep 17 00:00:00 2001
+From f70ae36fa1ff238804ca8193f43559788a14b398 Mon Sep 17 00:00:00 2001
 From: Radu Nicolau <radu.nicolau at intel.com>
 Date: Wed, 14 Nov 2018 12:19:09 +0000
 Subject: [PATCH] examples/bond: fix crash when there is no active slave
 
+[ upstream commit 292fdb76024fce3263e3c33009d37f46c10eddc5 ]
+
 If bond_ethdev_rx_burst() called more times with no active slaves
 the active slave index will point out of bounds, resulting in a
 segfault.
@@ -13,7 +15,6 @@
 slaves become active.
 
 Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")
-Cc: stable at dpdk.org
 
 Signed-off-by: Radu Nicolau <radu.nicolau at intel.com>
 Acked-by: Chas Williams <chas3 at att.com>
@@ -22,16 +23,16 @@
  1 file changed, 15 insertions(+)
 
 diff --git a/examples/bond/main.c b/examples/bond/main.c
-index 65f3c3980..ef86194ff 100644
+index 23d0981ab..314d85747 100644
 --- a/examples/bond/main.c
 +++ b/examples/bond/main.c
-@@ -221,4 +221,5 @@ bond_port_init(struct rte_mempool *mbuf_pool)
+@@ -222,4 +222,5 @@ bond_port_init(struct rte_mempool *mbuf_pool)
  	struct rte_eth_txconf txq_conf;
  	struct rte_eth_conf local_port_conf = port_conf;
 +	uint16_t wait_counter = 20;
  
  	retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ALB,
-@@ -275,4 +276,18 @@ bond_port_init(struct rte_mempool *mbuf_pool)
+@@ -276,4 +277,18 @@ bond_port_init(struct rte_mempool *mbuf_pool)
  		rte_exit(retval, "Start port %d failed (res=%d)", BOND_PORT, retval);
  
 +	printf("Waiting for slaves to become active...");


More information about the stable mailing list