From patchwork Wed Oct 23 12:10:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuan Can X-Patchwork-Id: 13847006 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 51C7A3FD4 for ; Wed, 23 Oct 2024 12:15:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729685743; cv=none; b=W6fkYy+0WqDc1SxTl2aq6UbjzOMt83PrNHONBJQ50KO3ALWSP0KPriGRBZuBhCJBuE1UOZu+Of+lP5VWSIEz3xmpV4Naso2ugtIq83ApTYMa9YUSGbIfboDyY3YHZDTh1oXe5Sr7eDoFjjupKcjzBvTQCjhJGxhO/YL3FSsmq8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729685743; c=relaxed/simple; bh=7Kk+tESQTNFhbfNuKaf92p3velYzaW+itNyK5vKwyfw=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=gLy0pa97owFspMLVCrPGqR0HEZ6tPBPB26jqDpCTHzfY60WJ7quFsvhAQPJgjsHoAhNWCvV2YWppDOdQT/krC6M8PBtPw2Ibb+KOMMpzYGIOQi752zHKH0yoTi702baHfm6qzGSojrbMZ6mqW/YSK5nA1UuJk6LPB/CZqcAipX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4XYScJ0yS8zdkJY; Wed, 23 Oct 2024 20:13:04 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id 80E4B140259; Wed, 23 Oct 2024 20:15:34 +0800 (CST) Received: from huawei.com (10.175.112.208) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 23 Oct 2024 20:15:33 +0800 From: Yuan Can To: , , , , , , , , , CC: Subject: [PATCH net v2] igb: Fix potential invalid memory access in igb_init_module() Date: Wed, 23 Oct 2024 20:10:48 +0800 Message-ID: <20241023121048.26905-1-yuancan@huawei.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-Patchwork-Delegate: kuba@kernel.org The pci_register_driver() can fail and when this happened, the dca_notifier needs to be unregistered, otherwise the dca_notifier can be called when igb fails to install, resulting to invalid memory access. Fixes: bbd98fe48a43 ("igb: Fix DCA errors and do not use context index for 82576") Signed-off-by: Yuan Can Reviewed-by: Simon Horman Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- Changes since v1: - Change fix tag to bbd98fe48a43. - Change target branch to net. --- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index f1d088168723..18284a838e24 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -637,6 +637,10 @@ static int __init igb_init_module(void) dca_register_notify(&dca_notifier); #endif ret = pci_register_driver(&igb_driver); +#ifdef CONFIG_IGB_DCA + if (ret) + dca_unregister_notify(&dca_notifier); +#endif return ret; }