summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2016-05-19 19:13:43 +0000
committerken <ken@FreeBSD.org>2016-05-19 19:13:43 +0000
commit66efac2b7a4aaf2aef95964f57573551bb9e81d0 (patch)
tree904322679cfe60f4a7560094cdb14a66b20d60a5
parenta17cbcde0a6c0d655fca3d82799c8d1ad343e666 (diff)
downloadFreeBSD-src-66efac2b7a4aaf2aef95964f57573551bb9e81d0.zip
FreeBSD-src-66efac2b7a4aaf2aef95964f57573551bb9e81d0.tar.gz
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 MFC after: 3 days
-rw-r--r--usr.sbin/camdd/camdd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/camdd/camdd.c b/usr.sbin/camdd/camdd.c
index badfce1..0218889 100644
--- a/usr.sbin/camdd/camdd.c
+++ b/usr.sbin/camdd/camdd.c
@@ -1079,9 +1079,7 @@ camdd_probe_file(int fd, struct camdd_io_opts *io_opts, int retry_count,
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_dev, struct camdd_io_opts *io_opts,
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));
OpenPOWER on IntegriCloud