Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1618579ybv; Fri, 21 Feb 2020 00:23:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxeUQWF6gBHXfbHLe1yY1XoKSJT2YRVBNDTFp5/sjelsoH5bGNkceChfTLCxgWE6FcRq1Zf X-Received: by 2002:aca:c45:: with SMTP id i5mr961781oiy.111.1582273433587; Fri, 21 Feb 2020 00:23:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273433; cv=none; d=google.com; s=arc-20160816; b=Y/1nlRKecHXtx0z12RFIqiAbWofCvzZicy0T8s+nE1r7PCwf0rpbnFZ3ULJx0i3OnP ervIbDm6OKthi4mydudKwrzKHppqCSfgT6iCOebfrRaWf0wMWhNhpA6kvRvYMxoNk/8L gidFh9Eteuak9VvWyuPD6fVOIm1jXDpfAV327prvSO85+J1j+xA0/Lzubr1kpvTj7gGe yMzBIUpUeESjNPi5OIMggT2uH8em9BYSY7axuJxEBXZ+T9MleVq7apvDobLGBw/7odXQ McrC+ZkzxyJ2leyoJvPCGHasXQhckyREQR7DSPTwJokiaEuPbdLx3uZLrRd14IRVemYi LoPA== 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=9vBY9WHoo0BusAivnbwVu0gxr99iFJmsyhrZLuYXuSw=; b=xjwxolRetsgd2vzZg/LI2b3aE2f4wwppbfd7kqMYgHrvtdYI4EfNOD0TUOwHuJLfrM WH378jAvAud+mMa+O6Eo1+OZCmQNosL3YJhRM4sRkvqS692jHEoXfJzqktXlSHGv36Ha PSlBm8TEGNfNX39KYw5bRHEw7+4cEjq1iqdL5srZluEyjP3cI28tApzx/yHLEFa4SZmK P7pK5975p7P5UZ+T6DXvtvaT0Q9Sf0uJztSJ8JjFh09N6dbVfF572KopMCoHr1HCk6AC BMo7/Px6Klj04ZkHDMETnH1WpppS/mI/NrtU1abzRL0LLeX/vPbgIHgC66237Uevybm9 INQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fXiN1yqy; 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 i15si1216437otk.120.2020.02.21.00.23.41; Fri, 21 Feb 2020 00:23:53 -0800 (PST) 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=fXiN1yqy; 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 S1730451AbgBUIXA (ORCPT + 99 others); Fri, 21 Feb 2020 03:23:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:34798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388398AbgBUIW7 (ORCPT ); Fri, 21 Feb 2020 03:22:59 -0500 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 B7E28206ED; Fri, 21 Feb 2020 08:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273378; bh=pMrgUaC8cg8znx/HKd1dZwHMdXvWd8cCe3wAG/kgbh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXiN1yqyawoonEY0Uie3f5E0jQIxgbTkTppziXA6EE7DBqce4ujCr1fG0VH7eUgsk sN3AODXt3Q/aFwQlC9TLPsVOOHLJ0Bz+B7EmfQh+Q2pj7BE0tikIYRbmRB/K1ODLSe WfD/pVjyEqSrf3ZG10CaJzBNCdtND2qF3//0kWLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brandon Maier , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 148/191] remoteproc: Initialize rproc_class before use Date: Fri, 21 Feb 2020 08:42:01 +0100 Message-Id: <20200221072308.331168455@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@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: Brandon Maier [ Upstream commit a8f40111d184098cd2b3dc0c7170c42250a5fa09 ] The remoteproc_core and remoteproc drivers all initialize with module_init(). However remoteproc drivers need the rproc_class during their probe. If one of the remoteproc drivers runs init and gets through probe before remoteproc_init() runs, a NULL pointer access of rproc_class's `glue_dirs` spinlock occurs. > Unable to handle kernel NULL pointer dereference at virtual address 000000dc > pgd = c0004000 > [000000dc] *pgd=00000000 > Internal error: Oops: 5 [#1] PREEMPT ARM > Modules linked in: > CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.106-rt56 #1 > Hardware name: Generic OMAP36xx (Flattened Device Tree) > task: c6050000 task.stack: c604a000 > PC is at rt_spin_lock+0x40/0x6c > LR is at rt_spin_lock+0x28/0x6c > pc : [] lr : [] psr: 60000013 > sp : c604bdc0 ip : 00000000 fp : 00000000 > r10: 00000000 r9 : c61c7c10 r8 : c6269c20 > r7 : c0905888 r6 : c6269c20 r5 : 00000000 r4 : 000000d4 > r3 : 000000dc r2 : c6050000 r1 : 00000002 r0 : 000000d4 > Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none ... > [] (rt_spin_lock) from [] (get_device_parent+0x54/0x17c) > [] (get_device_parent) from [] (device_add+0xe0/0x5b4) > [] (device_add) from [] (rproc_add+0x18/0xd8) > [] (rproc_add) from [] (my_rproc_probe+0x158/0x204) > [] (my_rproc_probe) from [] (platform_drv_probe+0x34/0x70) > [] (platform_drv_probe) from [] (driver_probe_device+0x2c8/0x420) > [] (driver_probe_device) from [] (__driver_attach+0x100/0x11c) > [] (__driver_attach) from [] (bus_for_each_dev+0x7c/0xc0) > [] (bus_for_each_dev) from [] (bus_add_driver+0x1cc/0x264) > [] (bus_add_driver) from [] (driver_register+0x78/0xf8) > [] (driver_register) from [] (do_one_initcall+0x100/0x190) > [] (do_one_initcall) from [] (kernel_init_freeable+0x130/0x1d0) > [] (kernel_init_freeable) from [] (kernel_init+0x8/0x114) > [] (kernel_init) from [] (ret_from_fork+0x14/0x24) > Code: e2843008 e3c2203f f5d3f000 e5922010 (e193cf9f) > ---[ end trace 0000000000000002 ]--- Signed-off-by: Brandon Maier Link: https://lore.kernel.org/r/20190530225223.136420-1-brandon.maier@rockwellcollins.com Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/remoteproc/remoteproc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index aa6206706fe33..abbef17c97ee2 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1786,7 +1786,7 @@ static int __init remoteproc_init(void) return 0; } -module_init(remoteproc_init); +subsys_initcall(remoteproc_init); static void __exit remoteproc_exit(void) { -- 2.20.1