patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [17.11] examples/bond: fix crash when there is no active slave
@ 2019-03-12 12:13 Radu Nicolau
  2019-03-12 22:19 ` Yongseok Koh
  0 siblings, 1 reply; 2+ messages in thread
From: Radu Nicolau @ 2019-03-12 12:13 UTC (permalink / raw)
  To: stable; +Cc: yskoh, Radu Nicolau

[ backported from upstream commit 292fdb76024f ]

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@intel.com>
Acked-by: Chas Williams <chas3@att.com>
---
 examples/bond/main.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 4f533e2..317e217 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -225,6 +225,7 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 	uint8_t i;
 	uint16_t nb_rxd = RTE_RX_DESC_DEFAULT;
 	uint16_t nb_txd = RTE_TX_DESC_DEFAULT;
+	uint16_t wait_counter = 20;
 
 	retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ALB,
 			0 /*SOCKET_ID_ANY*/);
@@ -271,6 +272,21 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 	if (retval < 0)
 		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);
 
 	struct ether_addr addr;
-- 
2.7.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [17.11] examples/bond: fix crash when there is no active slave
  2019-03-12 12:13 [dpdk-stable] [17.11] examples/bond: fix crash when there is no active slave Radu Nicolau
@ 2019-03-12 22:19 ` Yongseok Koh
  0 siblings, 0 replies; 2+ messages in thread
From: Yongseok Koh @ 2019-03-12 22:19 UTC (permalink / raw)
  To: Radu Nicolau; +Cc: stable


> On Mar 12, 2019, at 5:13 AM, Radu Nicolau <radu.nicolau@intel.com> wrote:
> 
> [ backported from upstream commit 292fdb76024f ]
> 
> 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@intel.com>
> Acked-by: Chas Williams <chas3@att.com>
> ---

applied to stable/17.11

Thanks,
Yongseok

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-12 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12 12:13 [dpdk-stable] [17.11] examples/bond: fix crash when there is no active slave Radu Nicolau
2019-03-12 22:19 ` Yongseok Koh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).