md: fix use after free when removing rdev via sysfs

rdev->mddev is no longer valid upon return from entry->store() when the
'remove' command is given.

Cc: <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Dan Williams 2008-04-30 00:52:28 -07:00 • committed by Linus Torvalds
commit 6a51830e14

View file

@ -2097,7 +2097,7 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr,
rv = -EBUSY;
else
rv = entry->store(rdev, page, length);
mddev_unlock(rdev->mddev);
mddev_unlock(mddev);
}
return rv;
}