From: MAEDA Naoaki <maeda.naoaki@jp.fujitsu.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, maeda.naoaki@jp.fujitsu.com
Subject: [PATCH] __release_region() race
Date: Thu, 12 Feb 2004 13:50:01 +0900 (JST) [thread overview]
Message-ID: <20040212.135001.85390321.maeda@jp.fujitsu.com> (raw)
Hi,
I am testing PCI hot-plug in 2.6.2 kernel, but sometimes
a struct resource tree in kernel/resource.c was broken
if multiple hot-plug requests are issued at the same time.
The reason is lots of drivers call release_region() on hot removal,
and __release_region(), which is invoked by release_region() macro,
changes the tree without holding a writer lock for resource_lock.
I think __release_region() must hold a writer lock as well as
__request_region() does.
A following patch fixes the issue in my environment.
Regards,
Naoaki Maeda
diff -Naur linux-2.6.3-rc2.org/kernel/resource.c linux-2.6.3-rc2/kernel/resource.c
--- linux-2.6.3-rc2.org/kernel/resource.c 2004-02-10 12:01:04.000000000 +0900
+++ linux-2.6.3-rc2/kernel/resource.c 2004-02-12 11:53:14.011014921 +0900
@@ -475,6 +475,8 @@
p = &parent->child;
end = start + n - 1;
+ write_lock(&resource_lock);
+
for (;;) {
struct resource *res = *p;
@@ -488,11 +490,15 @@
if (res->start != start || res->end != end)
break;
*p = res->sibling;
+ write_unlock(&resource_lock);
kfree(res);
return;
}
p = &res->sibling;
}
+
+ write_unlock(&resource_lock);
+
printk(KERN_WARNING "Trying to free nonexistent resource <%08lx-%08lx>\n", start, end);
}
next reply other threads:[~2004-02-12 4:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-12 4:50 MAEDA Naoaki [this message]
2004-02-12 4:59 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040212.135001.85390321.maeda@jp.fujitsu.com \
--to=maeda.naoaki@jp.fujitsu.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®