Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp252938ybh; Wed, 15 Jul 2020 00:43:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPmEltRLnNIuNBXOwfUxxg1K167raEWFZO9RIxhD5ovO+9+KO1im6fkGyvBeQOGjrtFyUW X-Received: by 2002:aa7:c407:: with SMTP id j7mr8233524edq.96.1594799009891; Wed, 15 Jul 2020 00:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594799009; cv=none; d=google.com; s=arc-20160816; b=s9fNyBr86qsukaf6MzGDiACTAz9lYcfNxX9fdweCLxqhb1kWkYKBdgpyE+57fLUHi/ 9EArkFMLx+mF2KwsdDItiGWQNJcviXaiI8e2U3LVsIZ99rZlPRercsobHBTRWiXJoezr eAjXXXZZUm+60PhWb7Cy888k/pgWjTorMdPZq32KTHU1zuR13p481MxtEZo44xAMwWdI fe1DMRku3vPV/8bARi0f6xXOLv1MJDVwWjU5/xJ6T0e6/FCYmQXd7+Fk9hxfuGZO+r0z osgi+d3z/h2bvAM0ME4h1VrQ0/kEJ2ec5D9dNXy3L9bNkcWif+zuH56G8F7bO6LfEK9w FvVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=fPZAAh6XsmYVOwEtQ9QgTBMrLWPHTOlempZ6e2w/4sU=; b=0yN3Fm251FRa1wnt35ewCN9pEW+i34eUJj6MoypPmENPfJl8i5eItGhUaoEzpr8gpM Liur7b3vPxhYO62G5S9KDGDV/3307iz7Jjv2usDfpR7oijIPJ3tYUVWw8U57je2NboR1 yGDP62VebXLIzaFXfLgUmOMN+Bk77FbDiK/IMQUV5Y4BW0kjY2pQ5hnoSS9t4l/q15CD 6pOF1VFX6bp9MVYdNX/w0sRF3PXja7svtCuujR/16qJ1rrTqGBxp2G69vAmEd+FrWkIK +gamw4091w4eFLfipRrl3uPS9va/GLIkuCDFYunl0OIGqOl99VYXdgOBbxqzqDVVBmRL JZ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XPTbra3Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du14si932512ejc.721.2020.07.15.00.43.04; Wed, 15 Jul 2020 00:43:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XPTbra3Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729411AbgGOHlh (ORCPT + 99 others); Wed, 15 Jul 2020 03:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729036AbgGOHld (ORCPT ); Wed, 15 Jul 2020 03:41:33 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64AD2C08C5C1 for ; Wed, 15 Jul 2020 00:41:32 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id a6so2884867wmm.0 for ; Wed, 15 Jul 2020 00:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=fPZAAh6XsmYVOwEtQ9QgTBMrLWPHTOlempZ6e2w/4sU=; b=XPTbra3ZOzVgnz5JAKFC8v0Agx2i05NYi4IOxJjdCn+CJ3soiT4ZTYkL9OfYp7qT3v 6xigK5yRETDbWC2odMm2ahd/ZEEyNWbaBxUpT61j5wTjSP9J5DvOa2xKfMR76dai1lzE 4/uAUhebVItP0adiJSFxvM8DAixnd5wBvS1iMQjvIe9ftZYeB3WAdY4WPbriwEQhapmD DEEdfxHtEccyTonf+aq3fs38hkGd36uzgkMSttOAGXQ9NaVkSQ6CySEXstQw7Jm2m0Xp uGb6JpHs7Nbtr6C+ONH1UDCiL2bqIDkpbZhkcyze2EmMx7STJm1x03qdquoBnG9emdyl jTNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fPZAAh6XsmYVOwEtQ9QgTBMrLWPHTOlempZ6e2w/4sU=; b=Ouu9j7BqtaB9ct+SGsf4E8MmQ2IcBqeIXZ35/xaGrJIfiw6rXz2LtAPPhsNYYXx818 Rj2pxxZ2sZ1s+AohGZ1JfqQJcmP0nZC5zJwZjOh1IAMDOfrSr7r6kSBCEF7NA3o+DNyS NJfHi00wS9cCc1Ei4goij9tv51YzMLNxXUspog0doCO6b8v1SuNraqJTxBKqWrJ9/Owk YOaYiJ22rYBA0x03Jh/QBSm1UVf659QMGA8j3LsVV/drYBQRbX8XJlFkQRn/UQs7UJW1 07OAd8arQlKql+8ZDYMRhaFMoZ4eFHMv7JTdGxs3PMs86by+9WYwslBx4yAmrRpbwSko 5qhg== X-Gm-Message-State: AOAM533Du1peXkDM36E3GkHVmj6JorqW1tZA8+1iskLujaToJhid+eVC MjnwRH51kJgkelrVS2JRh3K+8Q== X-Received: by 2002:a7b:c013:: with SMTP id c19mr7188412wmb.158.1594798890987; Wed, 15 Jul 2020 00:41:30 -0700 (PDT) Received: from localhost.localdomain (lns-bzn-59-82-252-131-168.adsl.proxad.net. [82.252.131.168]) by smtp.gmail.com with ESMTPSA id k11sm2303745wrd.23.2020.07.15.00.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 00:41:30 -0700 (PDT) From: Daniel Lezcano To: davem@davemloft.net Cc: daniel.lezcano@linaro.org, Jakub Kicinski , Jiri Pirko , Cong Wang , Johannes Berg , Michal Kubecek , netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] net: genetlink: Move initialization to core_initcall Date: Wed, 15 Jul 2020 09:41:18 +0200 Message-Id: <20200715074120.8768-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The generic netlink is initialized far after the netlink protocol itself at subsys_initcall. The devlink is initialized at the same level, but after, as shown by a disassembly of the vmlinux: [ ... ] 374 ffff8000115f22c0 <__initcall_devlink_init4>: 375 ffff8000115f22c4 <__initcall_genl_init4>: [ ... ] The function devlink_init() calls genl_register_family() before the generic netlink subsystem is initialized. As the generic netlink initcall level is set since 2005, it seems that was not a problem, but now we have the thermal framework initialized at the core_initcall level which creates the generic netlink family and sends a notification which leads to a subtle memory corruption only detectable when the CONFIG_INIT_ON_ALLOC_DEFAULT_ON option is set with the earlycon at init time. The thermal framework needs to be initialized early in order to begin the mitigation as soon as possible. Moving it to postcore_initcall is acceptable. This patch changes the initialization level for the generic netlink family to the core_initcall and comes after the netlink protocol initialization. Signed-off-by: Daniel Lezcano --- net/netlink/genetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 55ee680e9db1..36b8a1909826 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -1263,7 +1263,7 @@ static int __init genl_init(void) panic("GENL: Cannot register controller: %d\n", err); } -subsys_initcall(genl_init); +core_initcall(genl_init); static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group, gfp_t flags) -- 2.17.1