[PATCH 14/21] FIX: Level field can be NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When array changes its shape/level or array is about closing
level field in mdstat can be NULL. This causes core dump in mdmon.
Patch introduces guard in code for this situation.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 mdadm/mdadm/mdstat.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mdadm/mdadm/mdstat.c b/mdadm/mdadm/mdstat.c
index aecd1d4..1f818b1 100644
--- a/mdadm/mdadm/mdstat.c
+++ b/mdadm/mdadm/mdstat.c
@@ -291,6 +291,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 
 int mdstat_to_level(struct mdstat_ent *ms)
 {
+	if (ms->level == NULL)
+		return LEVEL_UNSUPPORTED;
 	if (strncmp(ms->level, "raid0", 5) == 0)
 		return 0;
 	else if (strncmp(ms->level, "raid10", 6) == 0)

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux