summaryrefslogtreecommitdiff
path: root/sys/dev/mfi/mfi.c
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2006-03-28 01:59:11 +0000
committerScott Long <scottl@FreeBSD.org>2006-03-28 01:59:11 +0000
commit20df0de426fb7f044eefab742a918a3b29c6a87c (patch)
treec865fcd6e6867a07613b7e8410bcc7bdbe3962aa /sys/dev/mfi/mfi.c
parentd7eda4625339399198f44a30a72f0500b1a49ee3 (diff)
Handle invalid capacity parameters from the firmware.
Notes
svn path=/head/; revision=157197
Diffstat (limited to 'sys/dev/mfi/mfi.c')
-rw-r--r--sys/dev/mfi/mfi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c
index 8efc0c011b05..064252ea8be2 100644
--- a/sys/dev/mfi/mfi.c
+++ b/sys/dev/mfi/mfi.c
@@ -911,6 +911,12 @@ mfi_add_ld(struct mfi_softc *sc, int id, uint64_t sectors, uint32_t secsize)
struct mfi_ld *ld;
device_t child;
+ if ((secsize == 0) || (sectors == 0)) {
+ device_printf(sc->mfi_dev, "Invalid capacity parameters for "
+ "logical disk %d\n", id);
+ return (EINVAL);
+ }
+
ld = malloc(sizeof(struct mfi_ld), M_MFIBUF, M_NOWAIT|M_ZERO);
if (ld == NULL) {
device_printf(sc->mfi_dev, "Cannot allocate ld\n");
@@ -929,7 +935,6 @@ mfi_add_ld(struct mfi_softc *sc, int id, uint64_t sectors, uint32_t secsize)
device_set_ivars(child, ld);
device_set_desc(child, "MFI Logical Disk");
- TAILQ_INSERT_TAIL(&sc->mfi_ld_tqh, ld, ld_link);
mtx_unlock(&sc->mfi_io_lock);
mtx_lock(&Giant);
bus_generic_attach(sc->mfi_dev);