[dpdk-dev] [PATCH v2 12/20] net/bnxt: check device is started before flow creation

Ajit Khaparde ajit.khaparde at broadcom.com
Thu Oct 3 01:25:53 CEST 2019


Check device is started before flow creation.
Since the vnic data structures aren't created until device start,
the driver dereferences NULL vnic if flow creation is attempted before
device is started,

Reviewed-by: Somnath Kotur <somnath.kotur at broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru at broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index cdfbb6c22f..7fdd50d706 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1550,6 +1550,15 @@ bnxt_flow_create(struct rte_eth_dev *dev,
 		return NULL;
 	}
 
+	if (!dev->data->dev_started) {
+		rte_flow_error_set(error,
+				   EINVAL,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+				   NULL,
+				   "Device must be started");
+		return NULL;
+	}
+
 	flow = rte_zmalloc("bnxt_flow", sizeof(struct rte_flow), 0);
 	if (!flow) {
 		rte_flow_error_set(error, ENOMEM,
-- 
2.20.1 (Apple Git-117)



More information about the dev mailing list