]> git.hungrycats.org Git - linux/commitdiff
[PATCH] MD - Fix two bugs that would cause sync_sbs to Oops
authorNeil Brown <neilb@cse.unsw.edu.au>
Wed, 24 Jul 2002 03:40:30 +0000 (20:40 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 24 Jul 2002 03:40:30 +0000 (20:40 -0700)
Sync_sbs tries to access the ->sb for the first rdev of an mddev.
This can oops as the wrong arg is given to list_entry, and also
if a define was faound to be failed, as failed devices have their ->sb
removed.  But that removal isn't necessary, so now an rdev will always
have an ->sb.

drivers/md/md.c

index d08613aea3bb1d44898c12febac975aff42186bb..a8e1281364eb52270c50f0bef2d5341b647adcf4 100644 (file)
@@ -847,7 +847,7 @@ static void sync_sbs(mddev_t * mddev)
                MD_BUG();
                return;
        }
-       rdev = list_entry(&mddev->disks.next, mdk_rdev_t, same_set);
+       rdev = list_entry(mddev->disks.next, mdk_rdev_t, same_set);
        sb = rdev->sb;
 
        memset(sb, 0, sizeof(*sb));
@@ -1044,8 +1044,6 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int on_disk)
        }
        INIT_LIST_HEAD(&rdev->same_set);
 
-       if (rdev->faulty && rdev->sb)
-               free_disk_sb(rdev);
        return rdev;
 
 abort_free: