Skip to contentSkip to conversation

net/ice: fix unsafe tailq element removal

PATCH Applied Beilei Xing 2 participants 2 messages Jul 19, 2019 – Jul 22, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: fix unsafe tailq element removal

TAILQ_FOREACH macro is not safe to remove elements during iterating tailq lists. Replace it with TAILQ_FOREACH_SAFE.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ice/ice_generic_flow.c +3 -1
index c2931a1c4..05c84afaf 100644
@@ -13,6 +13,7 @@
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_malloc.h>
+#include <rte_tailq.h>
 
 #include "ice_ethdev.h"
 #include "ice_generic_flow.h"
@@ -655,9 +656,10 @@ ice_flow_flush(struct rte_eth_dev *dev,
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct rte_flow *p_flow;
+	void *temp;
 	int ret = 0;
 
-	TAILQ_FOREACH(p_flow, &pf->flow_list, node) {
+	TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) {
 		ret = ice_flow_destroy(dev, p_flow, error);
 		if (ret) {
 			rte_flow_error_set(error, -ret,
Signature · 1 line
2.17.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Xing, Beilei
Sent: Friday, July 19, 2019 1:28 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: [PATCH] net/ice: fix unsafe tailq element removal

Quoted 6 lines

TAILQ_FOREACH macro is not safe to remove elements during iterating tailq lists. Replace it with TAILQ_FOREACH_SAFE.

Fixes d76116a4678f ("net/ice: add generic flow API")

Applied to dpdk-next-net-intel.

Thanks
Qi