From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B027DC48BDF for ; Tue, 22 Jun 2021 14:37:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 951E06115A for ; Tue, 22 Jun 2021 14:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231891AbhFVOjR (ORCPT ); Tue, 22 Jun 2021 10:39:17 -0400 Received: from isilmar-4.linta.de ([136.243.71.142]:36080 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbhFVOjP (ORCPT ); Tue, 22 Jun 2021 10:39:15 -0400 X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id 5A12B2012D1; Tue, 22 Jun 2021 14:36:58 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id 0C55780162; Tue, 22 Jun 2021 16:36:31 +0200 (CEST) Date: Tue, 22 Jun 2021 16:36:30 +0200 From: Dominik Brodowski To: Heikki Krogerus Cc: Andy Shevchenko , Lee Jones , Linux Kernel Mailing List Subject: Re: v5.13-rcX regression - NULL pointer dereference - MFD and software node API Message-ID: References: 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 Am Tue, Jun 22, 2021 at 05:10:44PM +0300 schrieb Heikki Krogerus: > On Tue, Jun 22, 2021 at 11:09:58AM +0300, Heikki Krogerus wrote: > > On Mon, Jun 21, 2021 at 05:31:50PM +0200, Dominik Brodowski wrote: > > > Am Mon, Jun 21, 2021 at 01:37:59PM +0300 schrieb Heikki Krogerus: > > > > On Mon, Jun 21, 2021 at 01:00:06PM +0300, Andy Shevchenko wrote: > > > > > Can you, please, attach this to the bug report? > > > > > > > > > > Long story here is that the device creation fails but we already have added > > > > > swnode to it. Meanwhile, device itself is not completely instantiated (yet) > > > > > and dev_name(dev) is NULL. The software_node_notify() is called with such > > > > > device and Oopses in the following line > > > > > > > > > > sysfs_remove_link(&swnode->kobj, dev_name(dev)); > > > > > > > > > > My patch fixes another issue that might happen before this and in the code > > > > > that retrieves swnode itself in the device_remove_software_node(). > > > > > > > > > > Of course my patch won't fix this issue. > > > > > > > > > > I have heard that Heikki is looking how to fix the issue in your case and > > > > > potentially in any other cases where device_add_software_node() is called > > > > > against not formed object instance. > > > > > > > > Dominik, can you test the attached patch to confirm if this really is > > > > the case. > > > > > > With this patch applied, the panic disappears. > > > > Thanks Dominik. I'll clean it and send it out today. > > Before I send the patch to Rafael and Greg, can you confirm that the > appropriate API (device_is_registered()) also works? I'm attaching > patch that should be the final version (if it works). Heikki, that works perfectly. Many thanks, especially for the speedy development of the bugfix! Best, Dominik