FAILED: patch "[PATCH] i40e: fix validation of VF state in get resources" failed to apply to 5.4-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y
git checkout FETCH_HEAD
git cherry-pick -x 877b7e6ffc23766448236e8732254534c518ba42
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025092913-monotype-pouch-f2e0@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 877b7e6ffc23766448236e8732254534c518ba42 Mon Sep 17 00:00:00 2001
From: Lukasz Czapnik <[email protected]>
Date: Wed, 13 Aug 2025 12:45:15 +0200
Subject: [PATCH] i40e: fix validation of VF state in get resources
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.
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +6 -1
@@ -1464,6 +1464,7 @@ static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr)* functions that may still be running at this point. */ clear_bit (I40E_VF_STATE_INIT , &vf->vf_states); +clear_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states);/* In the case of a VFLR, the HW has already reset the VF and we * just need to clean up, so don't hit the VFRTRIG register.
@@ -2130,7 +2131,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)size_t len =0 ;int ret; -if (!i40e_sync_vf_state (vf,I40E_VF_STATE_INIT )) { +i40e_sync_vf_state (vf,I40E_VF_STATE_INIT ); + +if (!test_bit (I40E_VF_STATE_INIT , &vf->vf_states) || +test_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states)) { aq_ret = -EINVAL ; goto err; }
@@ -2233,6 +2237,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) vf->default_lan_addr.addr); }set_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states); +set_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states); err:/* send the response back to the VF */
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +2 -1
@@ -41,7 +41,8 @@ enum i40e_vf_states {I40E_VF_STATE_MC_PROMISC ,I40E_VF_STATE_UC_PROMISC ,I40E_VF_STATE_PRE_ENABLE , - I40E_VF_STATE_RESETTING +I40E_VF_STATE_RESETTING , + I40E_VF_STATE_RESOURCES_LOADED, };/* VF capabilities */
Sasha Levin
maintainerPATCH 1/1 i40e: fix validation of VF state in get resources
From: Lukasz Czapnik <[email protected]>
[ Upstream commit 877b7e6ffc23766448236e8732254534c518ba42 ]
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.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 ++++++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +6 -1
@@ -1375,6 +1375,7 @@ static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr)* functions that may still be running at this point. */ clear_bit (I40E_VF_STATE_INIT , &vf->vf_states); +clear_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states);/* In the case of a VFLR, the HW has already reset the VF and we * just need to clean up, so don't hit the VFRTRIG register.
@@ -2048,7 +2049,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)size_t len =0 ;int ret; -if (!i40e_sync_vf_state (vf,I40E_VF_STATE_INIT )) { +i40e_sync_vf_state (vf,I40E_VF_STATE_INIT ); + +if (!test_bit (I40E_VF_STATE_INIT , &vf->vf_states) || +test_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states)) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -2144,6 +2148,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) vf->default_lan_addr.addr); }set_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states); +set_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states); err:/* send the response back to the VF */
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +2 -1
@@ -41,7 +41,8 @@ enum i40e_vf_states {I40E_VF_STATE_MC_PROMISC ,I40E_VF_STATE_UC_PROMISC ,I40E_VF_STATE_PRE_ENABLE , - I40E_VF_STATE_RESETTING +I40E_VF_STATE_RESETTING , + I40E_VF_STATE_RESOURCES_LOADED, };/* VF capabilities */
Signature · 1 line
2.51.0