net/bnxt: check if device is started before flow creation
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Wed, 2 Oct 2019 23:25:53 +0000 (16:25 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 8 Oct 2019 10:14:31 +0000 (12:14 +0200)
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 <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
drivers/net/bnxt/bnxt_flow.c

index 4e6b4d7..e7b70f2 100644 (file)
@@ -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,