summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-11-02 23:30:15 +0000
committerthompsa <thompsa@FreeBSD.org>2009-11-02 23:30:15 +0000
commit8bc2cf3863431c214eda6bec7dab1f676d348f0b (patch)
tree85d3916856bb6bf47d951126f5307001ba41347f /sys/cam/scsi
parent2b4e180195840f8f7f0d928c372ca7e02779cdf5 (diff)
downloadFreeBSD-src-8bc2cf3863431c214eda6bec7dab1f676d348f0b.zip
FreeBSD-src-8bc2cf3863431c214eda6bec7dab1f676d348f0b.tar.gz
Provide the same sanity check on the sector size in dagetcapacity as when the
disk is first probed. dagetcapacity is called whenever the disk is opened from geom via d_open(), a zero sector size will cause geom to panic later on.
Diffstat (limited to 'sys/cam/scsi')
-rw-r--r--sys/cam/scsi/scsi_da.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 8f740dc..32ca51b 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1948,8 +1948,15 @@ dagetcapacity(struct cam_periph *periph)
done:
- if (error == 0)
- dasetgeom(periph, block_len, maxsector);
+ if (error == 0) {
+ if (block_len >= MAXPHYS || block_len == 0) {
+ xpt_print(periph->path,
+ "unsupportable block size %ju\n",
+ (uintmax_t) block_len);
+ error = EINVAL;
+ } else
+ dasetgeom(periph, block_len, maxsector);
+ }
xpt_release_ccb(ccb);
OpenPOWER on IntegriCloud