Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1945770ybv; Fri, 14 Feb 2020 08:40:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwod8LqYLKBisIAJcGR6ObuaRRtYKTDGC/PofHjKPBjEU1VPljzfqc0VbR0nWtGGOh0RbjH X-Received: by 2002:aca:db56:: with SMTP id s83mr2497785oig.171.1581698408007; Fri, 14 Feb 2020 08:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698407; cv=none; d=google.com; s=arc-20160816; b=C4uxsI08ddodd/qNrlYD0oJ5WGy34ZlaPAdXY8fwcRXG/F5payUpv+AvzUpt1oqB6s HqBlPg3CtqV0YJqPAmBcA7+PaG/bKgw7paVZOk4FCoveAYLtLTslgJY1B6JcbOZJUYu5 Cfdc7L5TilWbk3CFtAz40N7fDQL+q5YLe5LyB9kU9poVR9L3p+DAAJ6RlYkEw59lX0ok /gdAYN+ifps5pEz9mr/YV31W8gExQWqyQFZD0UDiTq3Csj09IWtQF5KPKv+Nrkwi9JSw R7kwYYjvCsLKWrQmqW/1N+Fcpg5d21J9m81Sg9GTOBIegr/eecjMUW+FAe9Jj4nfeGHk AJwQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mdbPNL75xNVx0Oyr7v8We520Sz6pZiaakURRa17hi2E=; b=ncSQXkplsADJZPF+zSm9JM8TUCfUuLYQu87GToA4DjtqJ/un0idOHASXNMCTVciaKH 7ims6JlLZGRqg6EeoKiLSzYWoD3LYvu+d94wKW3hV0lq9ucC8qGTs8SaR/j2hE8MSGCQ Bdtyl3VnLj848m64N713GCYP6k8o0eZzbbywZ06peCT51je9ohzVV55KFxwQST5NHT+J MsRwBM9gkQuRAfggE3SH8UvpfWnmi+UiIfKbD3xQl0lF4ZjQtGs74z8OZFvCRVP4xo6q rFtRbLWCOL/1bTur7MYuCfPGgLTTUvqnCTWNpxBOY8YpTszbzFBZhOv4L4e6FB5kRYxW k/hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vmKOyqhO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k66si2921177oih.200.2020.02.14.08.39.55; Fri, 14 Feb 2020 08:40:07 -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=vmKOyqhO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393831AbgBNQiQ (ORCPT + 99 others); Fri, 14 Feb 2020 11:38:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:60060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405379AbgBNQXk (ORCPT ); Fri, 14 Feb 2020 11:23:40 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A8CFB24789; Fri, 14 Feb 2020 16:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697419; bh=dFBHdpTmb1pYHeFIPv7bP54uozuvvZ1+7N/kxCsJCKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vmKOyqhOQ07RI3n+TWBz6YftNMf/urjUvZfNpPgqZet5Wm4Ou9MWYKXLr6RupABOI +9e7CAYxBKy/M/MpBzNPaeBa5Yx9Rw/VLDTTWMlvAUTFkxTHvfSu9UC2NZno0f43Lu /BBKVMpUbFQfvg6cvYVup8KzjP12YG3oL7daVc4E= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Brandon Maier , Bjorn Andersson , Sasha Levin , linux-remoteproc@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 109/141] remoteproc: Initialize rproc_class before use Date: Fri, 14 Feb 2020 11:20:49 -0500 Message-Id: <20200214162122.19794-109-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 c6bfb3496684e..b99780574044a 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1488,7 +1488,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