Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2189260ybm; Thu, 23 May 2019 12:50:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqw49ZnGbUWU3Vl42fDVjBJBzOcMsI18gRQoX4Dr8zHOPFbNjS/5kiL6gPyV+hu67bWoukU1 X-Received: by 2002:a65:4105:: with SMTP id w5mr4838867pgp.260.1558641031176; Thu, 23 May 2019 12:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558641031; cv=none; d=google.com; s=arc-20160816; b=xvW8evyXHY4h9Zwcpmjl31lZ7Y3wksEXkQERHVRAslPnvYw9xD4x9SeZWyAeJOaYyu 63jp8Seso9Cpwp5MKHWJF0t76PyZs1HfDp9ls6NWKiIpxIxhSMbAsSNkn+Vgb60Ab7Eq oSVUJqNWfW0Xl2jS3bKZl6UkBm5VpongVd/gwWXCKYoI6jkWhq90uBBh7GAW4h1uKKWs vYm1T0aSrqdJkc/2IVfwuYvdLdOxDAY/mNaFz3x7SAPWFsT2BRKHxuvTmXTjaKgxuLgj 7jQwE30Ay6ebqrqCLzn/cSDuFjNdpAEu+Lpas7VfJEmb87ezTcN/4QPObe67e6i53jrX D5iA== 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=b5I695eAmZbD4ipn/gM7Z53iRTCTnwBmMVgiV120Wsg=; b=lnGDW80UC9i+1Usf8o3YT4ne1CxrcH1/BilOz7QZo+qrdCWGOUX8i5FXQNKnWxGp6T DPJtSwKxwubH5sM+f5RDbRBPj7oiH4Ls9mY3NPY2liSErsk4plgAaDKgFUOf7dwdevAx CUYnL02GP/EFr5yjxL8i/6YCauzbOsLdLFjU3TILz6GrnJ9DeBktAqzC1N5kV99oJ77u wx0nCxFWA9LnJnP4y+rCholOFdw1yWJbRSX87HZCJlEdS+twN4VyrhUWcMqulb0xy89+ v0gSImgfOcmbKYAh0+KEmw60CwAFPVQkn/X8TOU6+YDKkoyT+XZzDoflrbz213MI/tGT OHDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sXUmVAKn; 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 e2si282891pfh.286.2019.05.23.12.50.16; Thu, 23 May 2019 12:50:31 -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=sXUmVAKn; 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 S2388115AbfEWTLQ (ORCPT + 99 others); Thu, 23 May 2019 15:11:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:44620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388098AbfEWTLN (ORCPT ); Thu, 23 May 2019 15:11:13 -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 172C62133D; Thu, 23 May 2019 19:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558638672; bh=xdvvcA62MbAZMW3ffzFO2CIubH9bOSXjrHE8RuAPcdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sXUmVAKnMAt+9hi3qqE5RZurF9GckW1KnL3m1SnTgRCPNukFs2zEdjqfKrdUtC40b cBLxH8h38pXKqILvKLvEnhvoGSf9LXMxDDpG8ImF0p02ZurM9OXv5wI2pSx+J00gxi Se7R58UlcHf4x/uXJtzAg7KWbv6KvZ423L+XJlyg= 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 4.14 08/77] tipc: fix modprobe tipc failed after switch order of device registration Date: Thu, 23 May 2019 21:05:26 +0200 Message-Id: <20190523181721.240480012@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181719.982121681@linuxfoundation.org> References: <20190523181719.982121681@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 @@ -62,6 +62,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; @@ -88,6 +92,8 @@ out_subscr: out_nametbl: tipc_sk_rht_destroy(net); out_sk_rht: + tipc_socket_stop(); +out_socket: return err; } @@ -98,6 +104,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 = { @@ -133,10 +140,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; @@ -144,8 +147,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(); @@ -161,7 +162,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();