Skip to content

Commit

Permalink
md: lock address when changing attributes of component devices
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Feb 6, 2008
1 parent c5d79ad commit ca38805
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj);
int rv;

if (!entry->store)
return -EIO;
if (!capable(CAP_SYS_ADMIN))
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)
Expand Down

0 comments on commit ca38805

Please sign in to comment.