From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22C2A15AEB for ; Mon, 26 Jun 2023 21:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDF13C433CB; Mon, 26 Jun 2023 21:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687816233; bh=Eeiw8CB9PGKl2AeQXjeWrNGCZ4P7lu783mJJ9cLFcgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eEpRAAG8PvYuCGIgRPecHarmzLvfNNYWfvaxE46Ta2eskBV2DoJdBr5vXpdMsyox1 Sz/ynpGR6Sjgf8F8IlUADjP2QqLLSiKA+QYd9pTXvs8azEngw/MNIz94fcJyxiF5Y7 Y9Uo2sKdIY9N0j5hGU2IWc/oqzGygAw7ug4xZDh0QAX8WCQVvpHG9sqC/+umn6RGMM IqlPMqDlYaTbEUgmvgET/2X2tgE+8yIQCjOgF4CbUbKPs5x2nrdJcBmkr2/k1MO0SM LkgNiuNmBPd48bLjHt/YHSE1/P5pWE4xM20mbX3hIezAUxLAWezxYLw7HHM2xIoWEQ tHfg3yyxRshvw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Christensen , Sridhar Samudrala , "David S . Miller" , Sasha Levin , aelior@marvell.com, skalluru@marvell.com, manishc@marvell.com, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 04/15] bnx2x: fix page fault following EEH recovery Date: Mon, 26 Jun 2023 17:50:20 -0400 Message-Id: <20230626215031.179159-4-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230626215031.179159-1-sashal@kernel.org> References: <20230626215031.179159-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.35 Content-Transfer-Encoding: 8bit From: David Christensen [ Upstream commit 7ebe4eda4265642859507d1b3ca330d8c196cfe5 ] In the last step of the EEH recovery process, the EEH driver calls into bnx2x_io_resume() to re-initialize the NIC hardware via the function bnx2x_nic_load(). If an error occurs during bnx2x_nic_load(), OS and hardware resources are released and an error code is returned to the caller. When called from bnx2x_io_resume(), the return code is ignored and the network interface is brought up unconditionally. Later attempts to send a packet via this interface result in a page fault due to a null pointer reference. This patch checks the return code of bnx2x_nic_load(), prints an error message if necessary, and does not enable the interface. Signed-off-by: David Christensen Reviewed-by: Sridhar Samudrala Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 51b1690fd0459..a1783faf4fe99 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -14312,11 +14312,16 @@ static void bnx2x_io_resume(struct pci_dev *pdev) bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & DRV_MSG_SEQ_NUMBER_MASK; - if (netif_running(dev)) - bnx2x_nic_load(bp, LOAD_NORMAL); + if (netif_running(dev)) { + if (bnx2x_nic_load(bp, LOAD_NORMAL)) { + netdev_err(bp->dev, "Error during driver initialization, try unloading/reloading the driver\n"); + goto done; + } + } netif_device_attach(dev); +done: rtnl_unlock(); } -- 2.39.2