From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751798AbdBJHgH (ORCPT ); Fri, 10 Feb 2017 02:36:07 -0500 Received: from a.mx.secunet.com ([62.96.220.36]:46988 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751377AbdBJHgF (ORCPT ); Fri, 10 Feb 2017 02:36:05 -0500 Date: Fri, 10 Feb 2017 08:35:40 +0100 From: Steffen Klassert To: Florian Westphal CC: , , Subject: Re: [PATCH ipsec] xfrm: policy: init locks early Message-ID: <20170210073540.GY30338@gauss.secunet.com> References: <20170208105229.27285-1-fw@strlen.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20170208105229.27285-1-fw@strlen.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [10.182.7.102] X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 23 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: 90A72580-5AFD-4A14-9652-4C4544878FBB Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 08, 2017 at 11:52:29AM +0100, Florian Westphal wrote: > Dmitry reports following splat: > INFO: trying to register non-static key. > the code is fine but needs lockdep annotation. > turning off the locking correctness validator. > CPU: 0 PID: 13059 Comm: syz-executor1 Not tainted 4.10.0-rc7-next-20170207 #1 > [..] > spin_lock_bh include/linux/spinlock.h:304 [inline] > xfrm_policy_flush+0x32/0x470 net/xfrm/xfrm_policy.c:963 > xfrm_policy_fini+0xbf/0x560 net/xfrm/xfrm_policy.c:3041 > xfrm_net_init+0x79f/0x9e0 net/xfrm/xfrm_policy.c:3091 > ops_init+0x10a/0x530 net/core/net_namespace.c:115 > setup_net+0x2ed/0x690 net/core/net_namespace.c:291 > copy_net_ns+0x26c/0x530 net/core/net_namespace.c:396 > create_new_namespaces+0x409/0x860 kernel/nsproxy.c:106 > unshare_nsproxy_namespaces+0xae/0x1e0 kernel/nsproxy.c:205 > SYSC_unshare kernel/fork.c:2281 [inline] > > Problem is that when we get error during xfrm_net_init we will call > xfrm_policy_fini which will acquire xfrm_policy_lock before it was > initialized. Just move it around so locks get set up first. > > Reported-by: Dmitry Vyukov > Fixes: 283bc9f35bbbcb0e9 ("xfrm: Namespacify xfrm state/policy locks") > Signed-off-by: Florian Westphal Applied, thanks everyone!