From: NeilBrown Date: Wed, 6 Feb 2008 09:39:55 +0000 (-0800) Subject: md: lock address when changing attributes of component devices X-Git-Tag: v2.6.25-rc1~549 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=ca38805945edf5d1f5444b283eed95bb954772e8;p=linux-2.6-omap-h63xx.git md: lock address when changing attributes of component devices Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 7c9a87b02e7..39757566f39 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -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)