[RFC 23/47] net/bnxt: remove use of sys/queue.h
Stephen Hemminger
stephen at networkplumber.org
Tue Aug 19 01:27:34 CEST 2025
Fix unsafe use after free by using STAILQ_FOREACH_SAFE.
Fixes: e8fe0e067b68 ("net/bnxt: fix allocation of PF info struct")
Cc: ajit.khaparde at broadcom.com
Cc: stable at dpdk.org
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/bnxt/bnxt.h | 1 -
drivers/net/bnxt/bnxt_filter.c | 7 +++----
drivers/net/bnxt/bnxt_flow.c | 1 -
drivers/net/bnxt/bnxt_vnic.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c | 1 -
6 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index c9fdd36d3e..e9099a3ff2 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -9,7 +9,6 @@
#include <inttypes.h>
#include <stdbool.h>
#include <pthread.h>
-#include <sys/queue.h>
#include <rte_pci.h>
#include <bus_pci_driver.h>
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index 7b90ba651f..4c44506daa 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -3,8 +3,7 @@
* All rights reserved.
*/
-#include <sys/queue.h>
-
+#include <bsd_queue.h>
#include <rte_byteorder.h>
#include <rte_log.h>
#include <rte_malloc.h>
@@ -110,7 +109,7 @@ void bnxt_free_all_filters(struct bnxt *bp)
void bnxt_free_filter_mem(struct bnxt *bp)
{
- struct bnxt_filter_info *filter;
+ struct bnxt_filter_info *filter, *tmp;
uint16_t max_filters, i;
int rc = 0;
@@ -151,7 +150,7 @@ void bnxt_free_filter_mem(struct bnxt *bp)
bp->filter_info = NULL;
for (i = 0; i < bp->pf->max_vfs; i++) {
- STAILQ_FOREACH(filter, &bp->pf->vf_info[i].filter, next) {
+ STAILQ_FOREACH_SAFE(filter, &bp->pf->vf_info[i].filter, next, tmp) {
rte_free(filter);
STAILQ_REMOVE(&bp->pf->vf_info[i].filter, filter,
bnxt_filter_info, next);
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index a2e590540b..d3da309254 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -3,7 +3,6 @@
* All rights reserved.
*/
-#include <sys/queue.h>
#include <rte_log.h>
#include <rte_malloc.h>
diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h
index 5a4fd4ecb7..be232df2e7 100644
--- a/drivers/net/bnxt/bnxt_vnic.h
+++ b/drivers/net/bnxt/bnxt_vnic.h
@@ -6,7 +6,6 @@
#ifndef _BNXT_VNIC_H_
#define _BNXT_VNIC_H_
-#include <sys/queue.h>
#include <stdbool.h>
#include <rte_hash.h>
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index e0e31532fd..f8c46186fe 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <stdbool.h>
-#include <sys/queue.h>
#include "rte_version.h"
#include "rte_ethdev.h"
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
index 591bde96e8..cd97bc6635 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
@@ -4,7 +4,6 @@
*/
#include <math.h>
-#include <sys/queue.h>
#include <rte_log.h>
#include <rte_malloc.h>
--
2.47.2
More information about the dev
mailing list