• Jonathan Brassow's avatar
    MD: Prevent sysfs operations on uninitialized kobjects · 90584fc9
    Jonathan Brassow authored
    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: default avatarJonathan Brassow <jbrassow@redhat.com>
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    90584fc9
md.h 20.6 KB