From: Matthew Wilcox Date: Thu, 31 Dec 2020 22:05:08 +0000 (+0000) Subject: Releasing resources with children X-Git-Tag: howlett/maple_spf/20210104~74 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=450345ec8cf0f39957f8af3773f9eaeab36fc022;p=users%2Fjedix%2Flinux-maple.git Releasing resources with children What does it mean to release a resource with children? Should the children become children of the released resource's parent? Should they be released too? Should we fail the release? I bet we have no callers who expect this right now, but with insert_resource() we may get some. At the point where someone hits this BUG we can figure out what semantics we want. Signed-off-by: Matthew Wilcox Cc: Matthew Wilcox Signed-off-by: Andrew Morton --- diff --git a/kernel/resource.c b/kernel/resource.c index 46c410dccb38..8d3ed6c0fd95 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -222,6 +222,8 @@ static int __release_resource(struct resource *old, bool release_child) } } + WARN_ON(old->child); + p = &old->parent->child; for (;;) { tmp = *p;