summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2019-07-18 00:07:42 +0000
committerJohannes Weiner <hannes@cmpxchg.org>2019-07-18 00:07:42 +0000
commit013b1a52280b3f1ad9a19c25b456de87ad2b60e2 (patch)
treefd8f54c6df743963b942814dceb846eb87bfb40b
parent50b98fdea8ce42f51ec18751eec9f4bbe2375f11 (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;