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.
This commit is contained in:
Alexander Motin 2009-11-17 20:54:52 +00:00
parent 0e3aa3c51e
commit 5907c56d56
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=199436

View File

@ -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);