net/cxgbe: skip parsing match items with no spec
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Fri, 14 Dec 2018 19:01:54 +0000 (00:31 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 21 Dec 2018 15:22:40 +0000 (16:22 +0100)
Skip parsing pattern match items that have no spec. This fixes NULL
dereference when accessing their non-existent spec.

Fixes: ee61f5113b17 ("net/cxgbe: parse and validate flows")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
drivers/net/cxgbe/cxgbe_flow.c

index 4deaff8..7b87bdf 100644 (file)
@@ -732,6 +732,10 @@ cxgbe_rtef_parse_items(struct rte_flow *flow,
                                                "parse items cannot be repeated (except void)");
                        repeat[i->type] = 1;
 
+                       /* No spec found for this pattern item. Skip it */
+                       if (!i->spec)
+                               break;
+
                        /* validate the item */
                        ret = cxgbe_validate_item(i, e);
                        if (ret)