Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2176994ybm; Thu, 23 May 2019 12:37:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmoi3j81p9YgsxPxwj1VKveWjW/jl7ZQJAtW2ibijuHaW2pcZqj6gCx4TV8augS9YKpMKU X-Received: by 2002:a63:fd4a:: with SMTP id m10mr97867915pgj.302.1558640246885; Thu, 23 May 2019 12:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558640246; cv=none; d=google.com; s=arc-20160816; b=cCuk3EgVst3vsI3XdgkGtIH0GT9HvGZ8uB+c64V3RNnJK+brOR4ZtqpcDmhpIm6N6o SFbVRPKj33voCZ3xt+HJqFXbJo/TC59UtraYsbL0QvNB07tcfciBjWt9qYLzjsZN7fFh 2QSn+cmi74syf0izcNIGUWseXhPdP4MWBnT0fxyE2YcTcXAeZ/DIhofz/xmpu/2uPQX9 5t9VTfL46QhjORSsQ4Qa0M0efhF9EMSkRE+xq9HKR7CpxyNznUJ45FV5aKJbms1P/baa cpsmBI0xQMA7pAu+shvH3he30TSZKoDKSUXxKTDsrV4QC9Q2GWKWim9CFJ2EWw6/ISxL qUOQ== 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=CpQVpQxA08zu/eOYjviTFM/PCZFLBx+nzCRzQvlcmdE=; b=SHUcWl+HfQKcJB/TzeWJjJ4UbRREjC43NDxahMEFzka4uPehVme3CHRDCOUiXdINoX U/XZrSANNpREczm8CzOzUoLlXgZW4KHfL4ufadxS9JVMiUucjqAglWfhYtz+KlhGoPvC 85got6Q7UOVcLDoiSjo8Ld6ViKBOxwCuvEsHEu3AO3SbG3Hk4VxBdPbBr3KC+CThcis6 y8Tn2WUWRT+7i5vvMgoXIOKy9eqZ1+1txyxUOG0oRJSxb2TubpnmpufvsxbJHLk4P21G 10H8M+VRV1P/VfLo6lo7eY78HzXcO6w9gcLYxUAWEp41Su1Aii7voS8T+RGdSydLZJEW qgHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QnaNYW7r; 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 s145si483759pfc.283.2019.05.23.12.37.11; Thu, 23 May 2019 12:37:26 -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=QnaNYW7r; 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 S2390073AbfEWT04 (ORCPT + 99 others); Thu, 23 May 2019 15:26:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:38914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390226AbfEWT0y (ORCPT ); Thu, 23 May 2019 15:26:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 4427A2184E; Thu, 23 May 2019 19:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639613; bh=7CsxQZnR9OEYV73h7mR3bBrUUkWb0cqJ/BNieI70RKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnaNYW7rZ5A+uuwI8zDO8GqCap5RjFYv/82AxtaMJGybxKptLC0oIxhqJnEaPlYSD yfqktehxqwtRuS6xpET8ykcYL+dkhR8hIhZsIQSxJi7L3KwycP+42gsWIl9LV3lfDw JgpH9m+TbgmfryByE4JL9SSD+2pnOh1I7F8hgqW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junwei Hu , Wang Wang , Kang Zhou , Suanming Mou , "David S. Miller" Subject: [PATCH 5.1 013/122] tipc: fix modprobe tipc failed after switch order of device registration Date: Thu, 23 May 2019 21:05:35 +0200 Message-Id: <20190523181706.694989620@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181705.091418060@linuxfoundation.org> References: <20190523181705.091418060@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 From: Junwei Hu [ Upstream commit 532b0f7ece4cb2ffd24dc723ddf55242d1188e5e ] Error message printed: modprobe: ERROR: could not insert 'tipc': Address family not supported by protocol. when modprobe tipc after the following patch: switch order of device registration, commit 7e27e8d6130c ("tipc: switch order of device registration to fix a crash") Because sock_create_kern(net, AF_TIPC, ...) is called by tipc_topsrv_create_listener() in the initialization process of tipc_net_ops, tipc_socket_init() must be execute before that. I move tipc_socket_init() into function tipc_init_net(). Fixes: 7e27e8d6130c ("tipc: switch order of device registration to fix a crash") Signed-off-by: Junwei Hu Reported-by: Wang Wang Reviewed-by: Kang Zhou Reviewed-by: Suanming Mou Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -66,6 +66,10 @@ static int __net_init tipc_init_net(stru INIT_LIST_HEAD(&tn->node_list); spin_lock_init(&tn->node_list_lock); + err = tipc_socket_init(); + if (err) + goto out_socket; + err = tipc_sk_rht_init(net); if (err) goto out_sk_rht; @@ -92,6 +96,8 @@ out_subscr: out_nametbl: tipc_sk_rht_destroy(net); out_sk_rht: + tipc_socket_stop(); +out_socket: return err; } @@ -102,6 +108,7 @@ static void __net_exit tipc_exit_net(str tipc_bcast_stop(net); tipc_nametbl_stop(net); tipc_sk_rht_destroy(net); + tipc_socket_stop(); } static struct pernet_operations tipc_net_ops = { @@ -137,10 +144,6 @@ static int __init tipc_init(void) if (err) goto out_pernet; - err = tipc_socket_init(); - if (err) - goto out_socket; - err = tipc_bearer_setup(); if (err) goto out_bearer; @@ -148,8 +151,6 @@ static int __init tipc_init(void) pr_info("Started in single node mode\n"); return 0; out_bearer: - tipc_socket_stop(); -out_socket: unregister_pernet_subsys(&tipc_net_ops); out_pernet: tipc_unregister_sysctl(); @@ -165,7 +166,6 @@ out_netlink: static void __exit tipc_exit(void) { tipc_bearer_cleanup(); - tipc_socket_stop(); unregister_pernet_subsys(&tipc_net_ops); tipc_netlink_stop(); tipc_netlink_compat_stop();