summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2019-08-13 23:09:37 +0000
committerJohannes Weiner <hannes@cmpxchg.org>2019-08-13 23:09:37 +0000
commit65c0e3cdb18263cfe0eeee0c30df9e730b967ef3 (patch)
tree4b678e66b61552c0eb52b2d129a9595c5fd88b32
parent86359558cf7c8431903387d80f2ed569f3c6ad7f (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 88ee39fa9103..a6fd3317f9f3 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;