Skip to content

Commit 0004307

Browse files
committed
i40e: fix validation of VF state in get resources
jira KERNEL-238 cve CVE-2025-39969 Rebuild_History Non-Buildable kernel-6.12.0-124.16.1.el10_1 commit-author Lukasz Czapnik <lukasz.czapnik@intel.com> commit 877b7e6 VF state I40E_VF_STATE_ACTIVE is not the only state in which VF is actually active so it should not be used to determine if a VF is allowed to obtain resources. Use I40E_VF_STATE_RESOURCES_LOADED that is set only in i40e_vc_get_vf_resources_msg() and cleared during reset. Fixes: 61125b8 ("i40e: Fix failed opcode appearing if handling messages from 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: Rafal Romanowski <rafal.romanowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> (cherry picked from commit 877b7e6) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 3be9d9e commit 0004307

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,7 @@ static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr)
14671467
* functions that may still be running at this point.
14681468
*/
14691469
clear_bit(I40E_VF_STATE_INIT, &vf->vf_states);
1470+
clear_bit(I40E_VF_STATE_RESOURCES_LOADED, &vf->vf_states);
14701471

14711472
/* In the case of a VFLR, the HW has already reset the VF and we
14721473
* just need to clean up, so don't hit the VFRTRIG register.
@@ -2133,7 +2134,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
21332134
size_t len = 0;
21342135
int ret;
21352136

2136-
if (!i40e_sync_vf_state(vf, I40E_VF_STATE_INIT)) {
2137+
i40e_sync_vf_state(vf, I40E_VF_STATE_INIT);
2138+
2139+
if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states) ||
2140+
test_bit(I40E_VF_STATE_RESOURCES_LOADED, &vf->vf_states)) {
21372141
aq_ret = -EINVAL;
21382142
goto err;
21392143
}
@@ -2236,6 +2240,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
22362240
vf->default_lan_addr.addr);
22372241
}
22382242
set_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
2243+
set_bit(I40E_VF_STATE_RESOURCES_LOADED, &vf->vf_states);
22392244

22402245
err:
22412246
/* send the response back to the VF */

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ enum i40e_vf_states {
4141
I40E_VF_STATE_MC_PROMISC,
4242
I40E_VF_STATE_UC_PROMISC,
4343
I40E_VF_STATE_PRE_ENABLE,
44-
I40E_VF_STATE_RESETTING
44+
I40E_VF_STATE_RESETTING,
45+
I40E_VF_STATE_RESOURCES_LOADED,
4546
};
4647

4748
/* VF capabilities */

0 commit comments

Comments
 (0)