Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp253876ybi; Wed, 29 May 2019 20:43:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzijK+dy6Oc5n1qcsHMI1BED6EoCnP+af3JSeLibPV+dhKChuzUF4jsPop6/VdJEO0avB/ X-Received: by 2002:aa7:8c1a:: with SMTP id c26mr1583338pfd.25.1559187812228; Wed, 29 May 2019 20:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187812; cv=none; d=google.com; s=arc-20160816; b=yoCLCqhe3Y3bUb5NbN553fvK6LnRfVDpdGZ+eZlfyKYf0YC7QCaBJ3d0VF/7AReT8v gtGB1UehI1OqCl62ihfNIiQanHJ7jZE4knw6Odlezg0krq03C60Lg/DahdfSwlXzRQou iU3rPqjuQ4sQ2VJjwG9XLHoAR9YGLyPn6unxPK02WvoFqs/IaExq2Vk4BCaIpgwcdMK4 NDhaXw15d21w8EpnvQR6vOdurX/w50Ler86zyx9rCCsgmpj9evS4Gh6qv1mOVukp1tE9 EIvktJs5tAEEuavJDBpsL/MufM+4c8rnXoAjA6F+H8aL0Xag+zwWRhB1ZnYSfaO/lz4u Qinw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+ghJM8tEeNZHRLbXs94F1gB+qGiGhF8Ulo1sVUw+n7g=; b=Kxm2L0kG2OhUx89uhOnXtJ0blECd0/026KiRdgDmlACoCESB1DbFh5GNSrRs1nmcSN 66o/l8n9Bval2A+9FosEaUvtgbL2TmfNFnBD4tcvDAH8IwkDfNsIFJKuifYyJdzkdwed 71cjWxuw64yZYHbYPSUktmOgP3+/I4drEg12fQ8vZduUIemS1yXjl5cxjnEBf89BIgBe OqRQwhAldoBTGpDOA0+ru4Wh7cM9qBiQPZ+riH0/Dqtq5JscZPQ4QgMVbGheK4+Utcoe +UzSqyLfmI11RpDxl0K4hn3YfhMiXw+R8DxNO5M3OxyLom2u7Pio2cwWH7nAwqVLpOzb eqsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jLwK1N/w"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bx9si1620493pjb.76.2019.05.29.20.43.15; Wed, 29 May 2019 20:43:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jLwK1N/w"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731391AbfE3DVZ (ORCPT + 99 others); Wed, 29 May 2019 23:21:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:42266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728692AbfE3DQW (ORCPT ); Wed, 29 May 2019 23:16:22 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00DC5245AC; Thu, 30 May 2019 03:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186181; bh=sLy6X3e0LogK1de6O8dKO+dzc7OzvXYFoM0XMb1DSsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jLwK1N/w7h7G3X1cKYAqCaMfTW4Nx/J80pRSIvn+0XEZdRGGIcOEu43GXRsasmjYX x0cD2ZAHdYNP7vRZnsRzrQd7I41UDn73bBh9pWPVfhqlxYi+4IZrpWs0QWQKfRG8BO Hj78JO6kcyIaEErwBcrd9Z2ERq/MO+1s/jViE1cE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 045/276] cxgb4: Fix error path in cxgb4_init_module Date: Wed, 29 May 2019 20:03:23 -0700 Message-Id: <20190530030527.413192898@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit a3147770bea76c8dbad73eca3a24c2118da5e719 ] BUG: unable to handle kernel paging request at ffffffffa016a270 PGD 3270067 P4D 3270067 PUD 3271063 PMD 230bbd067 PTE 0 Oops: 0000 [#1 CPU: 0 PID: 6134 Comm: modprobe Not tainted 5.1.0+ #33 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 RIP: 0010:atomic_notifier_chain_register+0x24/0x60 Code: 1f 80 00 00 00 00 55 48 89 e5 41 54 49 89 f4 53 48 89 fb e8 ae b4 38 01 48 8b 53 38 48 8d 4b 38 48 85 d2 74 20 45 8b 44 24 10 <44> 3b 42 10 7e 08 eb 13 44 39 42 10 7c 0d 48 8d 4a 08 48 8b 52 08 RSP: 0018:ffffc90000e2bc60 EFLAGS: 00010086 RAX: 0000000000000292 RBX: ffffffff83467240 RCX: ffffffff83467278 RDX: ffffffffa016a260 RSI: ffffffff83752140 RDI: ffffffff83467240 RBP: ffffc90000e2bc70 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: 00000000014fa61f R12: ffffffffa01c8260 R13: ffff888231091e00 R14: 0000000000000000 R15: ffffc90000e2be78 FS: 00007fbd8d7cd540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffa016a270 CR3: 000000022c7e3000 CR4: 00000000000006f0 Call Trace: register_inet6addr_notifier+0x13/0x20 cxgb4_init_module+0x6c/0x1000 [cxgb4 ? 0xffffffffa01d7000 do_one_initcall+0x6c/0x3cc ? do_init_module+0x22/0x1f1 ? rcu_read_lock_sched_held+0x97/0xb0 ? kmem_cache_alloc_trace+0x325/0x3b0 do_init_module+0x5b/0x1f1 load_module+0x1db1/0x2690 ? m_show+0x1d0/0x1d0 __do_sys_finit_module+0xc5/0xd0 __x64_sys_finit_module+0x15/0x20 do_syscall_64+0x6b/0x1d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe If pci_register_driver fails, register inet6addr_notifier is pointless. This patch fix the error path in cxgb4_init_module. Fixes: b5a02f503caa ("cxgb4 : Update ipv6 address handling api") Signed-off-by: YueHaibing Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 961e3087d1d38..bb04c695ab9fd 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -6010,15 +6010,24 @@ static int __init cxgb4_init_module(void) ret = pci_register_driver(&cxgb4_driver); if (ret < 0) - debugfs_remove(cxgb4_debugfs_root); + goto err_pci; #if IS_ENABLED(CONFIG_IPV6) if (!inet6addr_registered) { - register_inet6addr_notifier(&cxgb4_inet6addr_notifier); - inet6addr_registered = true; + ret = register_inet6addr_notifier(&cxgb4_inet6addr_notifier); + if (ret) + pci_unregister_driver(&cxgb4_driver); + else + inet6addr_registered = true; } #endif + if (ret == 0) + return ret; + +err_pci: + debugfs_remove(cxgb4_debugfs_root); + return ret; } -- 2.20.1