From: Avinash Dayanand The condition `tc < adapter->num_tc` admits any tc value equal to or greater than num_tc, bypassing the destination-port validation and allowing traffic to be steered to a non-existent traffic class. Change the comparison to `tc > adapter->num_tc` to correctly reject out-of-range TC values. Fixes: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters") Signed-off-by: Avinash Dayanand Signed-off-by: Aleksandr Loktionov --- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index ab5f5adc..5e4035b 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -4062,7 +4062,7 @@ static int iavf_handle_tclass(struct iavf_adapter *adapter, u32 tc, { if (tc == 0) return 0; - if (tc < adapter->num_tc) { + if (tc > adapter->num_tc) { if (!filter->f.data.tcp_spec.dst_port) { dev_err(&adapter->pdev->dev, "Specify destination port to redirect to traffic class other than TC0\n"); -- 2.52.0