md/raid5: use sysfs_notify_dirent_safe to avoid NULL pointer
authorJonathan Brassow <jbrassow@redhat.com>
Thu, 13 Jan 2011 22:14:33 +0000 (09:14 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 13 Jan 2011 22:14:33 +0000 (09:14 +1100)
With the module parameter 'start_dirty_degraded' set,
raid5_spare_active() previously called sysfs_notify_dirent() with a NULL
argument (rdev->sysfs_state) when a rebuild finished.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/raid5.c

index 316fbe79389a91d6510ec26e06aaf6351675cd0d..9212c077095c31bc9514e8a38beed07490c22bc4 100644 (file)
@@ -5338,7 +5338,7 @@ static int raid5_spare_active(mddev_t *mddev)
                    && !test_bit(Faulty, &tmp->rdev->flags)
                    && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {
                        count++;
-                       sysfs_notify_dirent(tmp->rdev->sysfs_state);
+                       sysfs_notify_dirent_safe(tmp->rdev->sysfs_state);
                }
        }
        spin_lock_irqsave(&conf->device_lock, flags);