Illumos 5515 - dataset user hold doesn't reject empty tags
5515 dataset user hold doesn't reject empty tags Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com> Approved by: Matthew Ahrens <mahrens@delphix.com> References: https://www.illumos.org/issues/5515 https://github.com/illumos/illumos-gate/commit/752fd8d Ported-by: kernelOfTruth kerneloftruth@gmail.com Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
a6fb32b85a
commit
fc581e0507
|
@ -24,12 +24,11 @@
|
|||
* Portions Copyright 2011 Martin Matuska
|
||||
* Portions Copyright 2012 Pawel Jakub Dawidek <pawel@dawidek.net>
|
||||
* 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)
|
||||
|
|
Loading…
Reference in New Issue