Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6026783yba; Mon, 13 May 2019 23:52:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxegjbxM5kJ/a+tYhUjdUDqibKvj9svBVTtXLXGFzRtcnlGGFmAMMc+GisooOn2vwTU8UbB X-Received: by 2002:aa7:928b:: with SMTP id j11mr39097342pfa.200.1557816758158; Mon, 13 May 2019 23:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557816758; cv=none; d=google.com; s=arc-20160816; b=Fgo7DQ0AkQcFUnviL+UzSpYoQK55VvdmCbZ42hq1QuQcx5AnAoSVPK7kLdH3SWYI5M n5mDpTPRZ4hCsGTBn5Xo087jvuFn9KuYVpPkPytQCCuxfeIQTo4HC9HeIgSU8iTUCBGi hzg4kT0VRuc9wQFXVoRBGBCowzpl2hywB+TxMVkns33TG0/TNnCqtnL4cNFSKesEDoFR 23JgpNqLanK0aYXuWcz2J85kydYGBT2uznazwU9pjvJG7/VqsuxFwBCfv5v4Uc2f7Jvh HDbQD5TZ3o+LOaKm7feDIBWkm2eUcGG/+YMY6/trp0+3QUe2BiuZIsw1phG/UrcqtyV3 FbSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=0Tv4CU9Xrfl3jzMQ4opu39Js5UxhK7f2k9VKdI37D4Y=; b=Aa51fAa91lVW/CXLBfz3LefGxAXthkX9BbMKrusnMFcdbCMLY0L3Zi9RiIojxOVGfv rU09VWZJD/mI1dJeJSBqlQWTlYQuHJQR+hzXDEY3Q79iwW3kAwWcssc3jDzcZnpG84p/ MJtUgCGCaWN5K3lE8eNpYtWAy6XU0yOJHEbudcA0g0Lo+OoleDi2kOA2txtNNBJFhF6x LuFc6RyvHyB4Tdmvgx6BwoxNcjvZGbwCdmL8v40O5LWTGF9N76+QRrUSRYssX2kFvQTg 3d2NypL5QUwjjIrvcAdQEHrYkboyecqenTcL2gGRMP8X0ke0vVebrHrMOJF6th2lvbdP qHgQ== ARC-Authentication-Results: i=1; mx.google.com; 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 m21si18483171pls.121.2019.05.13.23.52.22; Mon, 13 May 2019 23:52:38 -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; 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 S1726314AbfENGjx (ORCPT + 99 others); Tue, 14 May 2019 02:39:53 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:36332 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725866AbfENGjw (ORCPT ); Tue, 14 May 2019 02:39:52 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 425E271A0A9898DCDD33; Tue, 14 May 2019 14:39:49 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Tue, 14 May 2019 14:39:39 +0800 From: YueHaibing To: , , , CC: , , , YueHaibing Subject: [PATCH] net/smc: Fix error path in smc_init Date: Tue, 14 May 2019 14:39:21 +0800 Message-ID: <20190514063921.41088-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If register_pernet_subsys success in smc_init, we should cleanup it in case any other error. Fixes: 64e28b52c7a6 (net/smc: add pnet table namespace support") Signed-off-by: YueHaibing --- net/smc/af_smc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 6f869ef..7d3207f 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -2019,7 +2019,7 @@ static int __init smc_init(void) rc = smc_pnet_init(); if (rc) - return rc; + goto out_pernet_subsys; rc = smc_llc_init(); if (rc) { @@ -2070,6 +2070,9 @@ static int __init smc_init(void) proto_unregister(&smc_proto); out_pnet: smc_pnet_exit(); +out_pernet_subsys: + unregister_pernet_subsys(&smc_net_ops); + return rc; } -- 1.8.3.1