Date: Mon, 2 Nov 2009 23:30:15 +0000 (UTC) From: Andrew Thompson <thompsa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r198832 - head/sys/cam/scsi Message-ID: <200911022330.nA2NUF3b073300@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: thompsa Date: Mon Nov 2 23:30:15 2009 New Revision: 198832 URL: http://svn.freebsd.org/changeset/base/198832 Log: 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: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Nov 2 23:02:11 2009 (r198831) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 2 23:30:15 2009 (r198832) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911022330.nA2NUF3b073300>