svn commit: r199436 - stable/8/sys/cam/scsi

Alexander Motin mav at FreeBSD.org
Tue Nov 17 20:54:52 UTC 2009


Author: mav
Date: Tue Nov 17 20:54:52 2009
New Revision: 199436
URL: http://svn.freebsd.org/changeset/base/199436

Log:
  MFC r198832:
  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.

Modified:
  stable/8/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/cam/scsi/scsi_da.c
==============================================================================
--- stable/8/sys/cam/scsi/scsi_da.c	Tue Nov 17 20:49:26 2009	(r199435)
+++ stable/8/sys/cam/scsi/scsi_da.c	Tue Nov 17 20:54:52 2009	(r199436)
@@ -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);
 


More information about the svn-src-stable mailing list