Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751778AbdITLjN (ORCPT ); Wed, 20 Sep 2017 07:39:13 -0400 Received: from ozlabs.org ([103.22.144.67]:59157 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbdITLjL (ORCPT ); Wed, 20 Sep 2017 07:39:11 -0400 From: Michael Ellerman To: Rob Herring , abdul Cc: linuxppc-dev , linux-kernel , Paul Mackerras , sachinp Subject: Re: [mainline][DLPAR][Oops] OF: ERROR: Bad of_node_put() on /cpus In-Reply-To: References: <1505473476.9665.13.camel@abdul.in.ibm.com> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Wed, 20 Sep 2017 21:39:05 +1000 Message-ID: <87bmm5lhuu.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1016 Lines: 43 Rob Herring writes: > On Fri, Sep 15, 2017 at 6:04 AM, abdul wrote: >> Hi, >> >> Mainline kernel panics during DLPAR CPU add/remove operation. >> >> Machine Type: Power8 PowerVM LPAR >> kernel 4.13.0 > > Did 4.12 work or when was it last working? I'm not seeing anything > recent in the DT code that looks suspicious. I'm pretty sure it's: int dlpar_attach_node(struct device_node *dn, struct device_node *parent) { int rc; dn->parent = parent; rc = of_attach_node(dn); if (rc) { printk(KERN_ERR "Failed to add device node %pOF\n", dn); return rc; } of_node_put(dn->parent); HERE ^^^^^^^^^^ return 0; } Prior to 215ee763f8cb ("powerpc: pseries: remove dlpar_attach_node dependency on full path"), we re-looked up the parent, and got another reference on it. That meant the put before the return there was correct. But now it's not because the caller has a reference to parent but it's not ours to drop. Testing a fix, will report back. cheers