Re: [PATCH] kobject: Ensure child's resources get released before parent's resources
From: Greg Kroah-Hartman
Date: Mon Dec 14 2015 - 16:40:27 EST
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 <rajatja@xxxxxxxxxx>
> Signed-off-by: Rajat Jain <rajatxjain@xxxxxxxxx>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/