Commit ca388059 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

md: lock address when changing attributes of component devices

Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c5d79adb
...@@ -2075,12 +2075,18 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr, ...@@ -2075,12 +2075,18 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr,
{ {
struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr);
mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj); mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj);
int rv;
if (!entry->store) if (!entry->store)
return -EIO; return -EIO;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
return entry->store(rdev, page, length); rv = mddev_lock(rdev->mddev);
if (!rv) {
rv = entry->store(rdev, page, length);
mddev_unlock(rdev->mddev);
}
return rv;
} }
static void rdev_free(struct kobject *ko) static void rdev_free(struct kobject *ko)
......
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