From owner-svn-src-projects@FreeBSD.ORG Thu Mar 31 12:43:39 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC8491065678; Thu, 31 Mar 2011 12:43:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCCE08FC08; Thu, 31 Mar 2011 12:43:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2VChdEG006532; Thu, 31 Mar 2011 12:43:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2VChdFh006530; Thu, 31 Mar 2011 12:43:39 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201103311243.p2VChdFh006530@svn.freebsd.org> From: Alexander Motin Date: Thu, 31 Mar 2011 12:43:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220192 - projects/graid/head/sys/geom/raid X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2011 12:43:40 -0000 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 =