From owner-svn-src-all@freebsd.org Wed May 25 14:30:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA139B49B6B; Wed, 25 May 2016 14:30:34 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A82901F56; Wed, 25 May 2016 14:30:34 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PEUXcU052593; Wed, 25 May 2016 14:30:33 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PEUXim052592; Wed, 25 May 2016 14:30:33 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201605251430.u4PEUXim052592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 25 May 2016 14:30:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300681 - stable/10/usr.sbin/camdd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 14:30:35 -0000 Author: ken Date: Wed May 25 14:30:33 2016 New Revision: 300681 URL: https://svnweb.freebsd.org/changeset/base/300681 Log: MFC r300224: ------------------------------------------------------------------------ r300224 | ken | 2016-05-19 13:13:43 -0600 (Thu, 19 May 2016) | 12 lines Adjust a couple of error cases in camdd(8). usr.sbin/camdd/camdd.c: In camdd_probe_file(), fix an error case after fstat where we were bailing out and leaving two lines of cleanup code unexecuted. Instead, just goto bailout_error. In camdd_probe_pass(), fail if the sector size is 0. ------------------------------------------------------------------------ Sponsored by: Spectra Logic Modified: stable/10/usr.sbin/camdd/camdd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/camdd/camdd.c ============================================================================== --- stable/10/usr.sbin/camdd/camdd.c Wed May 25 14:08:21 2016 (r300680) +++ stable/10/usr.sbin/camdd/camdd.c Wed May 25 14:30:33 2016 (r300681) @@ -1079,9 +1079,7 @@ camdd_probe_file(int fd, struct camdd_io retval = fstat(fd, &file_dev->sb); if (retval != 0) { warn("Cannot stat %s", dev->device_name); - goto bailout; - camdd_free_dev(dev); - dev = NULL; + goto bailout_error; } if (S_ISREG(file_dev->sb.st_mode)) { file_dev->file_type = CAMDD_FILE_REG; @@ -1383,6 +1381,11 @@ camdd_probe_pass(struct cam_device *cam_ block_len = scsi_4btoul(rcaplong.length); rcap_done: + if (block_len == 0) { + warnx("Sector size for %s%u is 0, cannot continue", + cam_dev->device_name, cam_dev->dev_unit_num); + goto bailout_error; + } bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr));