Skip to content

Commit

Permalink
net/iavf: fix core dump when the link is unstable
Browse files Browse the repository at this point in the history
Physical link instability may cause a core dump because unstable
physical links can result in a large number of link change events. Some
of these events may be captured by vf before vf resources are allocated,
and that will result in a core dump.

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

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

Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  • Loading branch information
kevin-intel authored and bruce-richardson committed Aug 22, 2024
1 parent fe44ec3 commit 22637bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/iavf/iavf_vchnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ 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 &
VIRTCHNL_VF_CAP_ADV_LINK_SPEED) {
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;
} else {
Expand Down

0 comments on commit 22637bd

Please sign in to comment.