summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2013-03-07 16:24:26 -0600
committerNeilBrown <neilb@suse.de>2013-03-20 13:17:57 +1100
commit90584fc93d461520a888f691144f0879283b3624 (patch)
treeb29d3af3e2af5ff3e3761525de851d88f102f9e5 /drivers/md/md.c
parente3620a3ad52609f64a2402e4b59300afb4b83b77 (diff)
downloadop-kernel-dev-90584fc93d461520a888f691144f0879283b3624.zip
op-kernel-dev-90584fc93d461520a888f691144f0879283b3624.tar.gz
MD: Prevent sysfs operations on uninitialized kobjects
MD: Prevent sysfs operations on uninitialized kobjects Device-mapper does not use sysfs; but when device-mapper is leveraging MD's RAID personalities, MD sometimes attempts to update sysfs. This patch adds checks for 'mddev-kobj.sd' in sysfs_[un]link_rdev to ensure it is about to operate on something valid. This patch also checks for 'mddev->kobj.sd' before calling 'sysfs_notify' in 'remove_and_add_spares'. Although 'sysfs_notify' already makes this check, doing so in 'remove_and_add_spares' prevents an additional mutex operation. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index fcb878f..aeceedf 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7663,10 +7663,8 @@ static int remove_and_add_spares(struct mddev *mddev)
removed++;
}
}
- if (removed)
- sysfs_notify(&mddev->kobj, NULL,
- "degraded");
-
+ if (removed && mddev->kobj.sd)
+ sysfs_notify(&mddev->kobj, NULL, "degraded");
rdev_for_each(rdev, mddev) {
if (rdev->raid_disk >= 0 &&
OpenPOWER on IntegriCloud