[PATCH iwl-net v2 4/5] iavf: fix TC boundary check in iavf_handle_tclass
Simon Horman
horms at kernel.org
Fri Sep 18 15:12:55 UTC 2026
On Tue, Sep 15, 2026 at 02:55:50PM +0200, Aleksandr Loktionov wrote:
> From: Avinash Dayanand <avinash.dayanand at intel.com>
>
> The condition 'tc < adapter->num_tc' only gates the destination-port
> check for in-range TCs; when tc is out of range (tc >= num_tc) the if
> body is skipped entirely and the function falls through to
> VIRTCHNL_ACTION_TC_REDIRECT and returns 0, silently steering traffic to
> a non-existent traffic class instead of rejecting the request.
>
> Simply flipping the comparison to 'tc > adapter->num_tc' does not fix
> this: it would let every in-range, non-zero tc (tc <= num_tc) skip the
> destination-port requirement entirely, while an out-of-range tc with a
> destination port set would still fall through and return 0.
>
> Fix this by explicitly rejecting tc >= adapter->num_tc with -EINVAL,
> and only then requiring a destination port for the remaining in-range,
> non-zero TCs.
>
> Fixes: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters")
> Cc: stable at vger.kernel.org
> Signed-off-by: Avinash Dayanand <avinash.dayanand at intel.com>
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov at intel.com>
Reviewed-by: Simon Horman <horms at kernel.org>
...
More information about the Intel-wired-lan
mailing list