[lkml]   [2019]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Resend [PATCH] kernel/resource.c: invalidate parent when freed resource has childs
On Fri, Aug 9, 2019 at 3:38 PM Wei Yang <> wrote:
> In theory, child may have siblings. Would it be possible to have several
> devices under xhci-hcd?

I'm less interested in the xhci-hcd case - which I certainly *hope* is
fixed already? - than in "if this happens somewhere else".

So if we do want to remove the parent (which may be a good idea with a
warning), and want to make sure that the children are really removed
from the resource hierarchy, we should do somethiing like

static bool detach_children(struct resource *res)
res = res->child;
if (!res)
return false;
do {
res->parent = NULL;
res = res->sibling;
} while (res);
return true;

and then we could write the __release_region() warning as

/* You should not release a resource that has children */

or something?

NOTE! The above is entirely untested, and written purely in my mail
reader. It might be seriously buggy, including not compiling, or doing
odd things. See it more as a "maybe something like this" code snippet
example than any kind of final form.


 \ /
  Last update: 2019-08-10 00:47    [W:0.153 / U:13.812 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site