aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/md.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7c9a87b02e77..39757566f39b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2075,12 +2075,18 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr,
2075{ 2075{
2076 struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); 2076 struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr);
2077 mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj); 2077 mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj);
2078 int rv;
2078 2079
2079 if (!entry->store) 2080 if (!entry->store)
2080 return -EIO; 2081 return -EIO;
2081 if (!capable(CAP_SYS_ADMIN)) 2082 if (!capable(CAP_SYS_ADMIN))
2082 return -EACCES; 2083 return -EACCES;
2083 return entry->store(rdev, page, length); 2084 rv = mddev_lock(rdev->mddev);
2085 if (!rv) {
2086 rv = entry->store(rdev, page, length);
2087 mddev_unlock(rdev->mddev);
2088 }
2089 return rv;
2084} 2090}
2085 2091
2086static void rdev_free(struct kobject *ko) 2092static void rdev_free(struct kobject *ko)