Skip to content

Commit fc581e0

Browse files
Josef 'Jeff' Sipekbehlendorf
authored andcommitted
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 illumos/illumos-gate@752fd8d Ported-by: kernelOfTruth kerneloftruth@gmail.com Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
1 parent a6fb32b commit fc581e0

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

module/zfs/zfs_ioctl.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@
2424
* Portions Copyright 2011 Martin Matuska
2525
* Portions Copyright 2012 Pawel Jakub Dawidek <pawel@dawidek.net>
2626
* 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.
2828
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
2929
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
3030
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
3131
* Copyright (c) 2013 Steven Hartland. All rights reserved.
32-
* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.
3332
*/
3433

3534
/*
@@ -4900,6 +4899,7 @@ zfs_ioc_smb_acl(zfs_cmd_t *zc)
49004899
static int
49014900
zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist)
49024901
{
4902+
nvpair_t *pair;
49034903
nvlist_t *holds;
49044904
int cleanup_fd = -1;
49054905
int error;
@@ -4909,6 +4909,19 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist)
49094909
if (error != 0)
49104910
return (SET_ERROR(EINVAL));
49114911

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+
49124925
if (nvlist_lookup_int32(args, "cleanup_fd", &cleanup_fd) == 0) {
49134926
error = zfs_onexit_fd_hold(cleanup_fd, &minor);
49144927
if (error != 0)

0 commit comments

Comments
 (0)