From: Ajit Khaparde Date: Wed, 2 Oct 2019 23:25:53 +0000 (-0700) Subject: net/bnxt: check if device is started before flow creation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=288d51eb188de7cb9cebfcfaf0d38bb283ec6187;p=dpdk.git net/bnxt: check if device is started before flow creation 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, Signed-off-by: Ajit Khaparde Reviewed-by: Somnath Kotur Reviewed-by: Venkat Duvvuru --- diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 4e6b4d7fce..e7b70f2416 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,