From: Mohammad Shuab Siddique <[email protected]>

When creating a flow that requires a destination queue but none is
specified in the flow create command, find_matching_vnic() returns
NULL and the code falls through to insert the new filter into
vnic->filter, dereferencing the NULL vnic and causing a segfault.

Check for a NULL vnic and reject the flow create with a clear error
instead of crashing.

Fixes: 59119d49529e ("net/bnxt: fix flow create when RSS is disabled")
Cc: [email protected]

Signed-off-by: Dakota Sicher <[email protected]>
Signed-off-by: Mohammad Shuab Siddique <[email protected]>
---
 drivers/net/bnxt/bnxt_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index a2e590540b..0a2899fbbd 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -2148,6 +2148,13 @@ bnxt_flow_create(struct rte_eth_dev *dev,
        }
 
        vnic = find_matching_vnic(bp, filter);
+       if (!vnic) {
+               rte_flow_error_set(error, EINVAL,
+                                  RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+                                  "Missing destination action for flow.");
+               bnxt_clear_one_vnic_filter(bp, filter);
+               goto free_filter;
+       }
 done:
        if (!ret || update_flow) {
                flow->filter = filter;
-- 
2.47.3

Reply via email to