From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932692AbbLNVkY (ORCPT ); Mon, 14 Dec 2015 16:40:24 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42778 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932382AbbLNVkX (ORCPT ); Mon, 14 Dec 2015 16:40:23 -0500 Date: Mon, 14 Dec 2015 13:40:22 -0800 From: Greg Kroah-Hartman To: Rajat Jain Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.com, rajatxjain@gmail.com Subject: Re: [PATCH] kobject: Ensure child's resources get released before parent's resources Message-ID: <20151214214022.GA24226@kroah.com> References: <1450119766-28102-1-git-send-email-rajatja@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450119766-28102-1-git-send-email-rajatja@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 14, 2015 at 11:02:46AM -0800, Rajat Jain wrote: > If the only remaining reference to a parent, is the one taken by > the child (in kobject_add_internal()), then when the last > reference to the child goes away, both child and its parents > shall be released. However, currently the resources of parent > get released first, followed by the child's resources: > > kobject_cleanup(child) > .... > kobject_del(child) > .... > kobject_put(child->parent) -> results in parent's release() > ... > child->kobj_type->release() -> Child's release() > > This is a problem because the child's release() method may still > need to use parent resources or memory for its own cleanup. E.g. > child may need parent pointer for dma_free_coherent() etc. > > Signed-off-by: Rajat Jain > Signed-off-by: Rajat Jain Why are you listed twice here? Where in the kernel is the parent being freed before the child that is causing this issue to happen? We should fix that root cause first... thanks, greg k-h