Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1BA5C678D4 for ; Thu, 2 Mar 2023 10:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230145AbjCBKUr (ORCPT ); Thu, 2 Mar 2023 05:20:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbjCBKUo (ORCPT ); Thu, 2 Mar 2023 05:20:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84EAC25960; Thu, 2 Mar 2023 02:20:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2020DB811FE; Thu, 2 Mar 2023 10:20:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E196C433EF; Thu, 2 Mar 2023 10:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1677752439; bh=lQMm+/FLt0+xB66zWlowc7zNUj0a7PqTWyhgbygdyYQ=; h=Date:From:To:Subject:References:In-Reply-To:From; b=C07CajyK8YEAdda2kQsW3vadORDZ5t4wWEUN0wF3hw7g/6q1AbRbdFzr6y5CDHCPK 2OjVysVC5uCQx8e9v8EfjIU5mbFAO4YdN5owSDrNXmPBYm3cOvt6I1bkUe50FUkcqT lnmOJ48REEDfGN4ur2YCYFu/Iof2RzsK4d/NVj1U= Date: Thu, 2 Mar 2023 11:20:37 +0100 From: Greg Kroah-Hartman To: Wolfram Sang , Geert Uytterhoeven , "Rafael J . Wysocki" , Arnd Bergmann , Lee Jones , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: Re: [PATCH] driver core: bus: Handle early calls to bus_to_subsys() Message-ID: References: <0a92979f6e790737544638e8a4c19b0564e660a2.1676983596.git.geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 28, 2023 at 11:57:02AM +0100, Wolfram Sang wrote: > On Tue, Feb 21, 2023 at 01:53:51PM +0100, Geert Uytterhoeven wrote: > > When calling soc_device_match() from early_initcall(), bus_kset is still > > NULL, causing a crash: > > > > Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028 > > ... > > Call trace: > > __lock_acquire+0x530/0x20f0 > > lock_acquire.part.0+0xc8/0x210 > > lock_acquire+0x64/0x80 > > _raw_spin_lock+0x4c/0x60 > > bus_to_subsys+0x24/0xac > > bus_for_each_dev+0x30/0xcc > > soc_device_match+0x4c/0xe0 > > r8a7795_sysc_init+0x18/0x60 > > rcar_sysc_pd_init+0xb0/0x33c > > do_one_initcall+0x128/0x2bc > > > > Before, bus_for_each_dev() handled this gracefully by checking that > > the back-pointer to the private structure was valid. > > > > Fix this by adding a NULL check for bus_kset to bus_to_subsys(). > > > > Fixes: 83b9148df2c95e23 ("driver core: bus: bus iterator cleanups") > > Signed-off-by: Geert Uytterhoeven > > Current top-of-head doesn't boot my Salvator-XS board, this patch fixed > it. > > Tested-by: Wolfram Sang > Great, now sent to Linus. greg k-h