From: Bryn M. Reeves <[EMAIL PROTECTED]>

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 <[EMAIL PROTECTED]>
Signed-off-by: Alasdair G Kergon <[EMAIL PROTECTED]>

---
 drivers/md/dm-mpath-rdac.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

Index: linux-2.6.23/drivers/md/dm-mpath-rdac.c
===================================================================
--- linux-2.6.23.orig/drivers/md/dm-mpath-rdac.c        2007-10-12 
13:15:23.000000000 +0100
+++ linux-2.6.23/drivers/md/dm-mpath-rdac.c     2007-10-12 13:15:24.000000000 
+0100
@@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handl
 
 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;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to