* [PATCH] dm-mpath-rdac.c init race
@ 2007-10-02 15:07 Bryn M. Reeves
0 siblings, 0 replies; only message in thread
From: Bryn M. Reeves @ 2007-10-02 15:07 UTC (permalink / raw)
To: device-mapper development
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The current dm-mpath-rdac has a race in the init function since the hw
handler is registered with DM core before allocating the workqueue.
This patch just re-orders the allocation to be before the call to
dm_register_hw_handler and adds calls to destroys the workqueue in error
paths.
Cheers,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFHAl606YSQoMYUY94RAoyvAJ44CB5yY5B+6y66c7DgL/nFId+jcgCgwWYX
rh+hKlNANqNZRw6KkyrYCL0=
=mzHx
-----END PGP SIGNATURE-----
[-- Attachment #2: rdac-init-race.patch --]
[-- Type: text/x-patch, Size: 1155 bytes --]
Re-order the initialisation of dm-rdac to avoid registering the hw
handler before the workqueue has been initialised. Closes a race
that would potentially give an oops.
Signed-off-by: Bryn M. Reeves <breeves@redhat.com>
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c
index 16b1613..a3d9d67 100644
--- a/drivers/md/dm-mpath-rdac.c
+++ b/drivers/md/dm-mpath-rdac.c
@@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = {
static int __init rdac_init(void)
{
- int r = dm_register_hw_handler(&rdac_handler);
-
- if (r < 0) {
- DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
- return r;
- }
+ int r;
rdac_wkqd = create_singlethread_workqueue("rdac_wkqd");
if (!rdac_wkqd) {
DMERR("Failed to create workqueue rdac_wkqd.");
- dm_unregister_hw_handler(&rdac_handler);
return -ENOMEM;
}
+ r = dm_register_hw_handler(&rdac_handler);
+ if (r < 0) {
+ DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
+ destroy_workqueue(rdac_wkqd);
+ return r;
+ }
+
DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER);
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-10-02 15:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-02 15:07 [PATCH] dm-mpath-rdac.c init race Bryn M. Reeves
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.