]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
i40e: fix idx validation in config queues msg
authorLukasz Czapnik <lukasz.czapnik@intel.com>
Wed, 13 Aug 2025 10:45:13 +0000 (12:45 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 18 Sep 2025 22:46:29 +0000 (15:46 -0700)
Ensure idx is within range of active/initialized TCs when iterating over
vf->ch[idx] in i40e_vc_config_queues_msg().

Fixes: c27eac48160d ("i40e: Enable ADq and create queue channel/s on VF")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Kamakshi Nellore <nellorex.kamakshi@intel.com> (A Contingent Worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

index 1c4f86221255ec997b015b4a4fb9628a087296e4..b6db4d78c02d4fb4091f333180652fdfc9cfe730 100644 (file)
@@ -2395,7 +2395,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
                }
 
                if (vf->adq_enabled) {
-                       if (idx >= ARRAY_SIZE(vf->ch)) {
+                       if (idx >= vf->num_tc) {
                                aq_ret = -ENODEV;
                                goto error_param;
                        }
@@ -2416,7 +2416,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
                 * to its appropriate VSIs based on TC mapping
                 */
                if (vf->adq_enabled) {
-                       if (idx >= ARRAY_SIZE(vf->ch)) {
+                       if (idx >= vf->num_tc) {
                                aq_ret = -ENODEV;
                                goto error_param;
                        }