diff options
author | Sam Falkner <Sam.Falkner@Sun.COM> | 2010-02-23 11:00:19 -0700 |
---|---|---|
committer | Sam Falkner <Sam.Falkner@Sun.COM> | 2010-02-23 11:00:19 -0700 |
commit | 6e27f86863a47869e7b2514d7445d3ea6fc6cf4a (patch) | |
tree | 39f18832531ddaf4ab35120b35bc857d06590e8a /usr | |
parent | 24cc0e1c125df7098c4418c91f0e2364e6b7a29f (diff) | |
download | illumos-gate-6e27f86863a47869e7b2514d7445d3ea6fc6cf4a.tar.gz |
6911541 'zfs mount' coredump
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/lib/libzfs/common/libzfs.h | 1 | ||||
-rw-r--r-- | usr/src/lib/libzfs/common/libzfs_util.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/zfs_ioctl.c | 12 |
3 files changed, 15 insertions, 4 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs.h b/usr/src/lib/libzfs/common/libzfs.h index b563053474..26aa32886c 100644 --- a/usr/src/lib/libzfs/common/libzfs.h +++ b/usr/src/lib/libzfs/common/libzfs.h @@ -86,6 +86,7 @@ enum { EZFS_SHARENFSFAILED, /* share(1M) failed */ EZFS_PERM, /* permission denied */ EZFS_NOSPC, /* out of space */ + EZFS_FAULT, /* bad address */ EZFS_IO, /* I/O error */ EZFS_INTR, /* signal received */ EZFS_ISSPARE, /* device is a hot spare */ diff --git a/usr/src/lib/libzfs/common/libzfs_util.c b/usr/src/lib/libzfs/common/libzfs_util.c index a400dc9c1e..09a1631925 100644 --- a/usr/src/lib/libzfs/common/libzfs_util.c +++ b/usr/src/lib/libzfs/common/libzfs_util.c @@ -144,6 +144,8 @@ libzfs_error_description(libzfs_handle_t *hdl) return (dgettext(TEXT_DOMAIN, "permission denied")); case EZFS_NOSPC: return (dgettext(TEXT_DOMAIN, "out of space")); + case EZFS_FAULT: + return (dgettext(TEXT_DOMAIN, "bad address")); case EZFS_IO: return (dgettext(TEXT_DOMAIN, "I/O error")); case EZFS_INTR: @@ -311,6 +313,10 @@ zfs_common_error(libzfs_handle_t *hdl, int error, const char *fmt, zfs_verror(hdl, EZFS_IO, fmt, ap); return (-1); + case EFAULT: + zfs_verror(hdl, EZFS_FAULT, fmt, ap); + return (-1); + case EINTR: zfs_verror(hdl, EZFS_INTR, fmt, ap); return (-1); diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c index f3c2c1d1bb..310a8c559e 100644 --- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c @@ -958,8 +958,8 @@ static int put_nvlist(zfs_cmd_t *zc, nvlist_t *nvl) { char *packed = NULL; + int error = 0; size_t size; - int error; VERIFY(nvlist_size(nvl, &size, NV_ENCODE_NATIVE) == 0); @@ -969,8 +969,9 @@ put_nvlist(zfs_cmd_t *zc, nvlist_t *nvl) packed = kmem_alloc(size, KM_SLEEP); VERIFY(nvlist_pack(nvl, &packed, &size, NV_ENCODE_NATIVE, KM_SLEEP) == 0); - error = ddi_copyout(packed, - (void *)(uintptr_t)zc->zc_nvlist_dst, size, zc->zc_iflags); + if (ddi_copyout(packed, (void *)(uintptr_t)zc->zc_nvlist_dst, + size, zc->zc_iflags) != 0) + error = EFAULT; kmem_free(packed, size); } @@ -4420,6 +4421,8 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp) zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP); error = ddi_copyin((void *)arg, zc, sizeof (zfs_cmd_t), flag); + if (error != 0) + error = EFAULT; if ((error == 0) && !(flag & FKIOCTL)) error = zfs_ioc_vec[vec].zvec_secpolicy(zc, cr); @@ -4458,7 +4461,8 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp) rc = ddi_copyout(zc, (void *)arg, sizeof (zfs_cmd_t), flag); if (error == 0) { - error = rc; + if (rc != 0) + error = EFAULT; if (zfs_ioc_vec[vec].zvec_his_log) zfs_log_history(zc); } |