24
24
* Portions Copyright 2011 Martin Matuska
25
25
* Portions Copyright 2012 Pawel Jakub Dawidek <pawel@dawidek.net>
26
26
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
27
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
28
28
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
29
29
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
30
30
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
31
31
* Copyright (c) 2013 Steven Hartland. All rights reserved.
32
- * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.
33
32
*/
34
33
35
34
/*
@@ -4900,6 +4899,7 @@ zfs_ioc_smb_acl(zfs_cmd_t *zc)
4900
4899
static int
4901
4900
zfs_ioc_hold (const char * pool , nvlist_t * args , nvlist_t * errlist )
4902
4901
{
4902
+ nvpair_t * pair ;
4903
4903
nvlist_t * holds ;
4904
4904
int cleanup_fd = -1 ;
4905
4905
int error ;
@@ -4909,6 +4909,19 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist)
4909
4909
if (error != 0 )
4910
4910
return (SET_ERROR (EINVAL ));
4911
4911
4912
+ /* make sure the user didn't pass us any invalid (empty) tags */
4913
+ for (pair = nvlist_next_nvpair (holds , NULL ); pair != NULL ;
4914
+ pair = nvlist_next_nvpair (holds , pair )) {
4915
+ char * htag ;
4916
+
4917
+ error = nvpair_value_string (pair , & htag );
4918
+ if (error != 0 )
4919
+ return (SET_ERROR (error ));
4920
+
4921
+ if (strlen (htag ) == 0 )
4922
+ return (SET_ERROR (EINVAL ));
4923
+ }
4924
+
4912
4925
if (nvlist_lookup_int32 (args , "cleanup_fd" , & cleanup_fd ) == 0 ) {
4913
4926
error = zfs_onexit_fd_hold (cleanup_fd , & minor );
4914
4927
if (error != 0 )
0 commit comments