net/ixgbe: fix mirror rule index overflow
authorQi Zhang <qi.z.zhang@intel.com>
Fri, 21 Jul 2017 08:56:37 +0000 (16:56 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 31 Jul 2017 17:58:41 +0000 (19:58 +0200)
Mirror rule id should not exceed the boundary defined by
IXGBE_MAX_MIRROR_RULES.

Fixes: fe3a45fd4104 ("ixgbe: add VMDq support")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ixgbe/ixgbe_ethdev.c

index e436dca..5dc007f 100644 (file)
@@ -5461,6 +5461,9 @@ ixgbe_mirror_rule_reset(struct rte_eth_dev *dev, uint8_t rule_id)
        if (ixgbe_vt_check(hw) < 0)
                return -ENOTSUP;
 
+       if (rule_id >= IXGBE_MAX_MIRROR_RULES)
+               return -EINVAL;
+
        memset(&mr_info->mr_conf[rule_id], 0,
               sizeof(struct rte_eth_mirror_conf));