md: fix uninitialized use of mddev->recovery_wait
authorDan Williams <dan.j.williams@intel.com>
Fri, 6 Jun 2008 05:45:53 +0000 (22:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Jun 2008 18:29:08 +0000 (11:29 -0700)
If an array was created with --assume-clean we will oops when trying to
set ->resync_max.

Fix this by initializing ->recovery_wait in mddev_find.

Cc: <stable@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/md.c

index 51c19f86ff99c3785b5d27838e755d04dabe5fe3..7cf512a34ccfc1ecd84c5264aff7d44184a14d95 100644 (file)
@@ -276,6 +276,7 @@ static mddev_t * mddev_find(dev_t unit)
        atomic_set(&new->active, 1);
        spin_lock_init(&new->write_lock);
        init_waitqueue_head(&new->sb_wait);
+       init_waitqueue_head(&new->recovery_wait);
        new->reshape_position = MaxSector;
        new->resync_max = MaxSector;
        new->level = LEVEL_NONE;
@@ -5665,7 +5666,6 @@ void md_do_sync(mddev_t *mddev)
                window/2,(unsigned long long) max_sectors/2);
 
        atomic_set(&mddev->recovery_active, 0);
-       init_waitqueue_head(&mddev->recovery_wait);
        last_check = 0;
 
        if (j>2) {