diff options
| author | Toomas Soome <tsoome@me.com> | 2017-04-13 09:15:18 +0300 |
|---|---|---|
| committer | Richard Lowe <richlowe@richlowe.net> | 2017-04-24 11:05:22 -0400 |
| commit | 6617bbf6c820fca35b3a835635d0c5f4641cfa23 (patch) | |
| tree | 6af6266a84b82be4337ba6982903e91faf84483f | |
| parent | 3c0982d96234beda3fbd087b8b47765d73998f64 (diff) | |
| download | illumos-joyent-6617bbf6c820fca35b3a835635d0c5f4641cfa23.tar.gz | |
8066 loader: zfs reader vdev_probe should check for minimum device size
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
| -rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/zfs/zfsimpl.c | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 018e7e7816..2fb500a314 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2017.4.22.1 +BOOT_VERSION = $(LOADER_VERSION)-2017.4.22.2 diff --git a/usr/src/boot/sys/boot/zfs/zfsimpl.c b/usr/src/boot/sys/boot/zfs/zfsimpl.c index c3f439855f..9257fcf2cc 100644 --- a/usr/src/boot/sys/boot/zfs/zfsimpl.c +++ b/usr/src/boot/sys/boot/zfs/zfsimpl.c @@ -924,7 +924,7 @@ vdev_probe(vdev_phys_read_t *phys_read, void *read_priv, spa_t **spap) { vdev_t vtmp; vdev_phys_t *vdev_label = (vdev_phys_t *) zap_scratch; - vdev_phys_t *tmp_label = zfs_alloc(sizeof(vdev_phys_t)); + vdev_phys_t *tmp_label; spa_t *spa; vdev_t *vdev, *top_vdev, *pool_vdev; off_t off; @@ -952,6 +952,12 @@ vdev_probe(vdev_phys_read_t *phys_read, void *read_priv, spa_t **spap) psize = P2ALIGN(ldi_get_size(read_priv), (uint64_t)sizeof (vdev_label_t)); + /* Test for minimum device size. */ + if (psize < SPA_MINDEVSIZE) + return (EIO); + + tmp_label = zfs_alloc(sizeof (vdev_phys_t)); + for (l = 0; l < VDEV_LABELS; l++) { off = vdev_label_offset(psize, l, offsetof(vdev_label_t, vl_vdev_phys)); @@ -983,6 +989,9 @@ vdev_probe(vdev_phys_read_t *phys_read, void *read_priv, spa_t **spap) zfs_free(tmp_label, sizeof (vdev_phys_t)); + if (best_txg == 0) + return (EIO); + if (vdev_label->vp_nvlist[0] != NV_ENCODE_XDR) return (EIO); |
