diff options
author | Dan Williams <dan.j.williams@intel.com> | 2010-06-17 02:26:04 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-06-17 02:26:04 +0200 |
commit | b526e52dc7cbdde98db9c9f8765be28ba6d71d78 (patch) | |
tree | c9c303fc940a4da78996d26f829271913fe8b730 /mapfile.c | |
parent | Fix man page reference to --level changes with --grow. (diff) | |
download | mdadm-b526e52dc7cbdde98db9c9f8765be28ba6d71d78.tar.xz mdadm-b526e52dc7cbdde98db9c9f8765be28ba6d71d78.zip |
Always assume SKIP_GONE_DEVS behaviour and kill the flag
...i.e. GET_DEVS == (GET_DEVS|SKIP_GONE_DEVS)
A null pointer dereference in Incremental.c can be triggered by
replugging a disk while the old name is in use. When mdadm -I is called
on the new disk we fail the call to sysfs_read(). I audited all the
locations that use GET_DEVS and it appears they can tolerate missing a
drive. So just make SKIP_GONE_DEVS the default behaviour.
Also fix up remaining unchecked usages of the sysfs_read() return value.
Reported-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'mapfile.c')
-rw-r--r-- | mapfile.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -368,7 +368,7 @@ void RebuildMap(void) } for (md = mdstat ; md ; md = md->next) { - struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_DEVS|SKIP_GONE_DEVS); + struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_DEVS); struct mdinfo *sd; if (!sra) @@ -486,7 +486,8 @@ void RebuildMap(void) for (md = mdstat ; md ; md = md->next) { struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_VERSION); - sysfs_uevent(sra, "change"); + if (sra) + sysfs_uevent(sra, "change"); sysfs_free(sra); } map_free(map); |