Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Mar 2011 12:43:39 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r220192 - projects/graid/head/sys/geom/raid
Message-ID:  <201103311243.p2VChdFh006530@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Mar 31 12:43:39 2011
New Revision: 220192
URL: http://svn.freebsd.org/changeset/base/220192

Log:
  Only disk with metadata could be part of the array. Accidental ID match for
  newly inserted disk should not cause NULL dereference. Such disk should be
  always handled as new.
  
  Found with:	Coverity Prevent(tm)
  CID:		9658

Modified:
  projects/graid/head/sys/geom/raid/md_jmicron.c

Modified: projects/graid/head/sys/geom/raid/md_jmicron.c
==============================================================================
--- projects/graid/head/sys/geom/raid/md_jmicron.c	Thu Mar 31 12:17:37 2011	(r220191)
+++ projects/graid/head/sys/geom/raid/md_jmicron.c	Thu Mar 31 12:43:39 2011	(r220192)
@@ -431,7 +431,10 @@ g_raid_md_jmicron_start_disk(struct g_ra
 	olddisk = NULL;
 
 	/* Find disk position in metadata by it's serial. */
-	disk_pos = jmicron_meta_find_disk(meta, pd->pd_disk_id);
+	if (pd->pd_meta != NULL)
+		disk_pos = jmicron_meta_find_disk(meta, pd->pd_disk_id);
+	else
+		disk_pos = -1;
 	if (disk_pos < 0) {
 		G_RAID_DEBUG1(1, sc, "Unknown, probably new or stale disk");
 		/* If we are in the start process, that's all for now. */
@@ -522,7 +525,7 @@ nofit:
 		 * Different disks may have different sizes/offsets,
 		 * especially in concat mode. Update.
 		 */
-		if (pd->pd_meta != NULL && !resurrection) {
+		if (!resurrection) {
 			sd->sd_offset =
 			    (off_t)pd->pd_meta->offset * 16 * 512; //ZZZ
 			sd->sd_size =



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103311243.p2VChdFh006530>