[PATCH] net/iavf: fix core dump when the link is unstable

Kaiwen Deng kaiwenx.deng at intel.com
Tue Aug 6 02:35:27 CEST 2024


Physical link instability may cause a core dump.
Unstable physical links can result in a large number of link
change events.Link change events captured by vf before vf
resources are allocated will result in a core dump.

This commit will check if vf_res is invalid before calling it.

Fixes: 5e03e316c753 ("net/iavf: handle virtchnl event message without interrupt")
Cc: stable at dpdk.org

Signed-off-by: Kaiwen Deng <kaiwenx.deng at intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 6d5969f084..b85debd40d 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -255,7 +255,7 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,
 		case VIRTCHNL_EVENT_LINK_CHANGE:
 			vf->link_up =
 				vpe->event_data.link_event.link_status;
-			if (vf->vf_res->vf_cap_flags &
+			if (vf->vf_res != NULL && vf->vf_res->vf_cap_flags &
 				VIRTCHNL_VF_CAP_ADV_LINK_SPEED) {
 				vf->link_speed =
 				    vpe->event_data.link_event_adv.link_speed;
-- 
2.34.1



More information about the stable mailing list