summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2017-12-13 01:10:34 +0000
committerJohannes Weiner <hannes@cmpxchg.org>2017-12-13 01:10:34 +0000
commit10ef15663386bb83fd90bac91622da65224200b6 (patch)
tree7fe0c92a2214f2bbf0f7f55d6cc2e5221578e315
parentcb7143b8ed1f085afa1d768b7481644bddd8e57c (diff)
Make sure nobody's leaking resources
Currently, releasing a resource also releases all of its children. That made sense when request_resource was the main method of dividing up the memory map. With the increased use of insert_resource, it seems to me that we should instead reparent the newly orphaned resources. Before we do that, let's make sure that nobody's actually relying on the current semantics. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Cc: Greg KH <greg@kroah.com> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--kernel/resource.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/resource.c b/kernel/resource.c
index 8c527d83ca76..173c9fd242e6 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -246,6 +246,14 @@ static int __release_resource(struct resource *old, bool release_child)
{
struct resource *tmp, **p, *chd;
+ if (old->child) {
+ static int warned;
+ if (warned < 5) {
+ warned++;
+ WARN_ON(1);
+ }
+ }
+
p = &old->parent->child;
for (;;) {
tmp = *p;