[PATCH 04/13] fix: possible segfault if current_vol does not match subarray

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

 



If super->current_vol points to index that does not exist, dev becomes NULL. It causes segfault during an attempt to read its contents (issue found by
Klocwork)

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@xxxxxxxxx>
---
 super-intel.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index a196ca3..1a536f9 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1421,10 +1421,14 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info)
 {
 	struct intel_super *super = st->sb;
 	struct imsm_dev *dev = get_imsm_dev(super, super->current_vol);
-	struct imsm_map *map = get_imsm_map(dev, 0);
+	struct imsm_map *map;
 	struct dl *dl;
 	char *devname;
 
+	if (!dev)
+		return;
+	map = get_imsm_map(dev, 0);
+
 	for (dl = super->disks; dl; dl = dl->next)
 		if (dl->raiddisk == info->disk.raid_disk)
 			break;
-- 
1.6.4.2


--
Best Regards,
Przemyslaw Hawrylewicz-Czarnowski
Software Development Engineer


--
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