diff options
author | Josef 'Jeff' Sipek <[email protected]> | 2016-01-09 18:37:15 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-01-12 13:52:26 -0800 |
commit | fc581e05072c21d82729091ebe34248fd0777460 (patch) | |
tree | f099eddc6c100c93917923df6d5b7061bfc6cb12 /module | |
parent | a6fb32b85acb2245260aa1cbe396aea1f16b9dd3 (diff) |
Illumos 5515 - dataset user hold doesn't reject empty tags
5515 dataset user hold doesn't reject empty tags
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Yuri Pankov <[email protected]>
Reviewed by: Saso Kiselkov <[email protected]>
Approved by: Matthew Ahrens <[email protected]>
References:
https://www.illumos.org/issues/5515
https://github.com/illumos/illumos-gate/commit/752fd8d
Ported-by: kernelOfTruth [email protected]
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/zfs_ioctl.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index d026e92d6..003079902 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -24,12 +24,11 @@ * Portions Copyright 2011 Martin Matuska * Portions Copyright 2012 Pawel Jakub Dawidek <[email protected]> * Copyright (c) 2012, Joyent, Inc. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. - * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ /* @@ -4900,6 +4899,7 @@ zfs_ioc_smb_acl(zfs_cmd_t *zc) static int zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist) { + nvpair_t *pair; nvlist_t *holds; int cleanup_fd = -1; int error; @@ -4909,6 +4909,19 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist) if (error != 0) return (SET_ERROR(EINVAL)); + /* make sure the user didn't pass us any invalid (empty) tags */ + for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL; + pair = nvlist_next_nvpair(holds, pair)) { + char *htag; + + error = nvpair_value_string(pair, &htag); + if (error != 0) + return (SET_ERROR(error)); + + if (strlen(htag) == 0) + return (SET_ERROR(EINVAL)); + } + if (nvlist_lookup_int32(args, "cleanup_fd", &cleanup_fd) == 0) { error = zfs_onexit_fd_hold(cleanup_fd, &minor); if (error != 0) |