Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp368458imu; Wed, 12 Dec 2018 18:58:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/VH+A4VpH3PwjdqnCkpkmBpHg7/viRn5CfhSg5uxPAS6fZqhlo/ZzL8WHrFfFCpi0xeBmqS X-Received: by 2002:a63:dc54:: with SMTP id f20mr2018732pgj.410.1544669936264; Wed, 12 Dec 2018 18:58:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544669936; cv=none; d=google.com; s=arc-20160816; b=UFiXH5F8lBcU4taErhR4lJDhcTm+HNQafpo7WePkh36p0OiRRfunuLmq/+McjnSjVu EHneiP2QTPmUwE5qvrPw5LQVWNUdQyjR4KyZbkORaaNSv5WElDcLXAG5FvnoYiXoTgb1 N6rLjaO11EzWMWJqSbzdnIbq30FLkTWuoXvb08qXM0gLO20Z5CoWzZK3R8n/4UPWQM9A KhY7HgzFo6OK3XFqtFIeZ6iy7fDajNB9AdhrrKqLBTXW750GdKC8KmvvCtd2Dqs6BJgZ CTBYKncgqxn1HxI2ng0fw4s7cJF5goYoP+U3ItL3/V4P7+asBSWxKLP6RW8ku6yGQogD lj1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=UhY6b34MThLgbKyr01DI+TacR7doy0MD2OeSE5Pqctw=; b=GM566Wunw59BENSOgECMtyy+jZiZvxJV/1fXiEz5AE+f3J/LQZ+4YWrTWdLniZBw47 cUpLIChAFLtRtJWLeQ7WcVI7IyU0ppo8mTDuWttflc3WXwJtZm1OaSN43Ltlh4GGwCJW Hx+/Znyn0LC7DbXKat7OWI+1rSxVYl1OMeAIhm1Zm4ZR9MUITtDGDcPpjIe/XA6CGEk5 CYpHa5004frCua1fojtgrhM0JA4j3OZkxiNhhyRUqt1vgauNGAnonDbAyfjF5ANfz204 SNeQ/vCaXslJUrw4OpnJq0h9Spdve9UQiIewWngdfLWL7oZ6jAkaH6En76BRj4DfmbZd w+Gw== ARC-Authentication-Results: i=1; mx.google.com; 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 n1si464231pgh.172.2018.12.12.18.58.41; Wed, 12 Dec 2018 18:58:56 -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; 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 S1726816AbeLMC5S (ORCPT + 99 others); Wed, 12 Dec 2018 21:57:18 -0500 Received: from ozlabs.org ([203.11.71.1]:43985 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbeLMC5R (ORCPT ); Wed, 12 Dec 2018 21:57:17 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 43Fdd71xbWz9s8r; Thu, 13 Dec 2018 13:57:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: Frank Rowand , Rob Herring Cc: mwb@linux.vnet.ibm.com, linuxppc-dev , Tyrel Datwyler , tlfalcon@linux.vnet.ibm.com, minkim@us.ibm.com, devicetree@vger.kernel.org, "linux-kernel\@vger.kernel.org" Subject: Re: [PATCH v03] powerpc/mobility: Fix node detach/rename problem In-Reply-To: <48aa028d-b786-7704-70ff-75a6d2321474@gmail.com> References: <871s6oxkdf.fsf@concordia.ellerman.id.au> <48aa028d-b786-7704-70ff-75a6d2321474@gmail.com> Date: Thu, 13 Dec 2018 13:57:16 +1100 Message-ID: <877egew2ur.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Frank Rowand writes: > On 12/11/18 8:07 AM, Rob Herring wrote: >> On Tue, Dec 11, 2018 at 7:29 AM Michael Ellerman wrote: ... >>> diff --git a/drivers/of/base.c b/drivers/of/base.c >>> index 09692c9b32a7..d8e4534c0686 100644 >>> --- a/drivers/of/base.c >>> +++ b/drivers/of/base.c >>> @@ -1190,6 +1190,10 @@ struct device_node *of_find_node_by_phandle(phandle handle) >>> if (phandle_cache[masked_handle] && >>> handle == phandle_cache[masked_handle]->phandle) >>> np = phandle_cache[masked_handle]; >>> + >>> + /* If we find a detached node, remove it */ >>> + if (of_node_check_flag(np, OF_DETACHED)) >>> + np = phandle_cache[masked_handle] = NULL; > > The bug you found exposes a couple of different issues, a little bit > deeper than the proposed fix. I'll work on a fuller fix tonight or > tomorrow. OK thanks. >> I'm wondering if we should explicitly remove the node from the cache >> when we set OF_DETACHED. Otherwise, it could be possible that the node >> pointer has been freed already. Or maybe we need both? > > Yes, it should be explicitly removed. I may also add in a paranoia check in > of_find_node_by_phandle(). That seems best to me. cheers