summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2019-07-19 00:07:01 +0000
committerJohannes Weiner <hannes@cmpxchg.org>2019-07-19 00:07:01 +0000
commit798c8bf486634f68ce153c0db88d5c376d61c450 (patch)
tree6614bb08ef71ba8b72455011de625d91abd9570e
parent6df0cb1a3477cf68879257574060b658bbeff046 (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 7ea4306503c5..6eff1a743d8c 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -214,6 +214,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;