5515 dataset user hold doesn't reject empty tags

Author: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@752fd8dabc
This commit is contained in:
Andriy Gapon 2015-06-05 16:52:23 +00:00
parent cd7e9ce6ff
commit 22c047db3f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/illumos/dist/; revision=284031

View File

@ -5132,6 +5132,19 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist)
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)