Skip to content

Commit dfd129e

Browse files
pvts-matPlaidCat
authored andcommitted
i40e: add validation for ring_len param
jira VULN-158762 cve CVE-2025-39973 commit-author Lukasz Czapnik <lukasz.czapnik@intel.com> commit 55d2256 The `ring_len` parameter provided by the virtual function (VF) is assigned directly to the hardware memory context (HMC) without any validation. To address this, introduce an upper boundary check for both Tx and Rx queue lengths. The maximum number of descriptors supported by the hardware is 8k-32. Additionally, enforce alignment constraints: Tx rings must be a multiple of 8, and Rx rings must be a multiple of 32. Fixes: 5c3c48a ("i40e: implement virtual device interface") 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: Rafal Romanowski <rafal.romanowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> (cherry picked from commit 55d2256) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent 0d54746 commit dfd129e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,13 @@ static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id,
562562

563563
/* only set the required fields */
564564
tx_ctx.base = info->dma_ring_addr / 128;
565+
566+
/* ring_len has to be multiple of 8 */
567+
if (!IS_ALIGNED(info->ring_len, 8) ||
568+
info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) {
569+
ret = -EINVAL;
570+
goto error_context;
571+
}
565572
tx_ctx.qlen = info->ring_len;
566573
tx_ctx.rdylist = le16_to_cpu(vsi->info.qs_handle[0]);
567574
tx_ctx.rdylist_act = 0;
@@ -628,6 +635,13 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
628635

629636
/* only set the required fields */
630637
rx_ctx.base = info->dma_ring_addr / 128;
638+
639+
/* ring_len has to be multiple of 32 */
640+
if (!IS_ALIGNED(info->ring_len, 32) ||
641+
info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) {
642+
ret = -EINVAL;
643+
goto error_param;
644+
}
631645
rx_ctx.qlen = info->ring_len;
632646

633647
if (info->splithdr_enabled) {

0 commit comments

Comments
 (0)