From patchwork Tue Aug 6 00:35:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaiwen Deng X-Patchwork-Id: 142908 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B107B4563A; Tue, 6 Aug 2024 03:38:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E7717402ED; Tue, 6 Aug 2024 03:38:22 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by mails.dpdk.org (Postfix) with ESMTP id B7A44400D5; Tue, 6 Aug 2024 03:38:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722908301; x=1754444301; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=InwThuwdmKJqz+QIxLlaKCRddoJqTcaTx6/6kW4c0FA=; b=BYOIP5747BITt7nDunECYb9FscSlNxBn8r2nfrKX4gZKH8VpACzOr2py 0tIw6wpVFCBVlf1DM7Y1dvfuNfjstbDHJE5BgGYdptbbdupWSZWFIrlP1 k0GS9TzqztSbvd0TEFpyUGoePvby9qj4dsdoeMGP0lEj8HUwwyf3tHYMu +X+qbJyaUnzbtDCkuDmd/zkmK1gRPk/hU4z69qqAvYX6TsGQP1E/dk8jG 71a7AMX5eraV6fpnAxNZvxXXnLpG79QtOQ2NPk3hmr2UXLly+oZSxuwew rUP/JnuiZUsqtmN0oJQSfMeLV8nXFTEi/0x2bH9IhVHuDjpEoHQzjXqRx Q==; X-CSE-ConnectionGUID: 1+0IWNgoT4O0R4EQfHEOgw== X-CSE-MsgGUID: IVMJpVcJQoiLStuBnzoMGA== X-IronPort-AV: E=McAfee;i="6700,10204,11155"; a="46302957" X-IronPort-AV: E=Sophos;i="6.09,266,1716274800"; d="scan'208";a="46302957" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2024 18:38:20 -0700 X-CSE-ConnectionGUID: jVMtXM/RRNuVHHK46lw+uA== X-CSE-MsgGUID: v61MlYXXSZKrjgzWk/kf3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,266,1716274800"; d="scan'208";a="87272568" Received: from shwdenpg561.ccr.corp.intel.com (HELO dpdk..) ([10.239.252.3]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2024 18:38:17 -0700 From: Kaiwen Deng To: dev@dpdk.org Cc: stable@dpdk.org, Kaiwen Deng , Jingjing Wu , Beilei Xing , Ting Xu Subject: [PATCH] net/iavf: fix core dump when the link is unstable Date: Tue, 6 Aug 2024 08:35:27 +0800 Message-Id: <20240806003527.2901320-1-kaiwenx.deng@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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@dpdk.org Signed-off-by: Kaiwen Deng Acked-by: Bruce Richardson --- 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;