Commit d1cde62a authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] MD - Fix two bugs that would cause sync_sbs to Oops

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.
parent ec4f2142
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment