aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2019-10-16 06:34:58 +0000
committerAndriy Gapon <avg@FreeBSD.org>2019-10-16 06:34:58 +0000
commit0a48ec6f6273d1e43d7a4c287c36606d41ad78d7 (patch)
treef47ca7d0a9c38ece2db6e7adec8053c298b5d081
parentb7cab79de23a8bfb689bfb5bddb4deb2e09b360d (diff)
downloadsrc-0a48ec6f6273d1e43d7a4c287c36606d41ad78d7.tar.gz
src-0a48ec6f6273d1e43d7a4c287c36606d41ad78d7.zip
10731 zfs: NULL pointer errors
illumos/illumos-gate@dd328bf6d39366b8d7bde6a36114538fc14332dd https://github.com/illumos/illumos-gate/commit/dd328bf6d39366b8d7bde6a36114538fc14332dd https://www.illumos.org/issues/10731 Author: Toomas Soome <tsoome@me.com>
Notes
Notes: svn path=/vendor-sys/illumos/dist/; revision=353613
-rw-r--r--uts/common/fs/zfs/dsl_pool.c3
-rw-r--r--uts/common/fs/zfs/sa.c4
-rw-r--r--uts/common/fs/zfs/zcp.c18
-rw-r--r--uts/common/fs/zfs/zcp_get.c7
-rw-r--r--uts/common/fs/zfs/zcp_global.c2
-rw-r--r--uts/common/fs/zfs/zcp_iter.c20
-rw-r--r--uts/common/fs/zfs/zcp_synctask.c16
-rw-r--r--uts/common/fs/zfs/zfs_ioctl.c12
8 files changed, 40 insertions, 42 deletions
diff --git a/uts/common/fs/zfs/dsl_pool.c b/uts/common/fs/zfs/dsl_pool.c
index 2a9ec5585af5..00ac657cb5db 100644
--- a/uts/common/fs/zfs/dsl_pool.c
+++ b/uts/common/fs/zfs/dsl_pool.c
@@ -1147,8 +1147,7 @@ int
dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag,
dmu_tx_t *tx)
{
- return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, NULL,
- tx, B_FALSE));
+ return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, tx, B_FALSE));
}
/*
diff --git a/uts/common/fs/zfs/sa.c b/uts/common/fs/zfs/sa.c
index 4a70e3916b6a..d8cf42db5fa8 100644
--- a/uts/common/fs/zfs/sa.c
+++ b/uts/common/fs/zfs/sa.c
@@ -1577,12 +1577,12 @@ sa_attr_register_sync(sa_handle_t *hdl, dmu_tx_t *tx)
mutex_enter(&sa->sa_lock);
- if (!sa->sa_need_attr_registration || sa->sa_master_obj == NULL) {
+ if (!sa->sa_need_attr_registration || sa->sa_master_obj == 0) {
mutex_exit(&sa->sa_lock);
return;
}
- if (sa->sa_reg_attr_obj == NULL) {
+ if (sa->sa_reg_attr_obj == 0) {
sa->sa_reg_attr_obj = zap_create_link(hdl->sa_os,
DMU_OT_SA_ATTR_REGISTRATION,
sa->sa_master_obj, SA_REGISTRY, tx);
diff --git a/uts/common/fs/zfs/zcp.c b/uts/common/fs/zfs/zcp.c
index bad8a56f5846..5a2449b45094 100644
--- a/uts/common/fs/zfs/zcp.c
+++ b/uts/common/fs/zfs/zcp.c
@@ -608,23 +608,23 @@ zcp_dataset_hold_error(lua_State *state, dsl_pool_t *dp, const char *dsname,
{
if (error == ENOENT) {
(void) zcp_argerror(state, 1, "no such dataset '%s'", dsname);
- return (NULL); /* not reached; zcp_argerror will longjmp */
+ return (0); /* not reached; zcp_argerror will longjmp */
} else if (error == EXDEV) {
(void) zcp_argerror(state, 1,
"dataset '%s' is not in the target pool '%s'",
dsname, spa_name(dp->dp_spa));
- return (NULL); /* not reached; zcp_argerror will longjmp */
+ return (0); /* not reached; zcp_argerror will longjmp */
} else if (error == EIO) {
(void) luaL_error(state,
"I/O error while accessing dataset '%s'", dsname);
- return (NULL); /* not reached; luaL_error will longjmp */
+ return (0); /* not reached; luaL_error will longjmp */
} else if (error != 0) {
(void) luaL_error(state,
"unexpected error %d while accessing dataset '%s'",
error, dsname);
- return (NULL); /* not reached; luaL_error will longjmp */
+ return (0); /* not reached; luaL_error will longjmp */
}
- return (NULL);
+ return (0);
}
/*
@@ -647,10 +647,10 @@ static zcp_lib_info_t zcp_debug_info = {
.func = zcp_debug,
.pargs = {
{ .za_name = "debug string", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
@@ -676,10 +676,10 @@ static zcp_lib_info_t zcp_exists_info = {
.func = zcp_exists,
.pargs = {
{ .za_name = "dataset", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
diff --git a/uts/common/fs/zfs/zcp_get.c b/uts/common/fs/zfs/zcp_get.c
index 85e00a0f93d1..1478c288d8d5 100644
--- a/uts/common/fs/zfs/zcp_get.c
+++ b/uts/common/fs/zfs/zcp_get.c
@@ -330,8 +330,7 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname,
error = get_clones_stat_impl(ds, clones);
if (error == 0) {
/* push list to lua stack */
- VERIFY0(zcp_nvlist_to_lua(state, clones, NULL,
- NULL));
+ VERIFY0(zcp_nvlist_to_lua(state, clones, NULL, 0));
/* source */
(void) lua_pushnil(state);
}
@@ -792,10 +791,10 @@ static zcp_lib_info_t zcp_get_prop_info = {
.pargs = {
{ .za_name = "dataset", .za_lua_type = LUA_TSTRING},
{ .za_name = "property", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
diff --git a/uts/common/fs/zfs/zcp_global.c b/uts/common/fs/zfs/zcp_global.c
index 9a869a6012b4..c25431fd6703 100644
--- a/uts/common/fs/zfs/zcp_global.c
+++ b/uts/common/fs/zfs/zcp_global.c
@@ -68,7 +68,7 @@ static const zcp_errno_global_t errno_globals[] = {
{"ENOTSUP", ENOTSUP},
{"EDQUOT", EDQUOT},
{"ENAMETOOLONG", ENAMETOOLONG},
- {NULL, NULL}
+ {NULL, 0}
};
static void
diff --git a/uts/common/fs/zfs/zcp_iter.c b/uts/common/fs/zfs/zcp_iter.c
index 351e400fb5d4..0236c6474ef6 100644
--- a/uts/common/fs/zfs/zcp_iter.c
+++ b/uts/common/fs/zfs/zcp_iter.c
@@ -110,10 +110,10 @@ static zcp_list_info_t zcp_clones_list_info = {
.gc = NULL,
.pargs = {
{ .za_name = "snapshot", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
@@ -199,10 +199,10 @@ static zcp_list_info_t zcp_snapshots_list_info = {
.gc = NULL,
.pargs = {
{ .za_name = "filesystem | volume", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
@@ -300,10 +300,10 @@ static zcp_list_info_t zcp_children_list_info = {
.gc = NULL,
.pargs = {
{ .za_name = "filesystem | volume", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
@@ -381,10 +381,10 @@ static zcp_list_info_t zcp_props_list_info = {
.pargs = {
{ .za_name = "filesystem | snapshot | volume",
.za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
@@ -439,10 +439,10 @@ static zcp_list_info_t zcp_system_props_list_info = {
.func = zcp_system_props_list,
.pargs = {
{ .za_name = "dataset", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
diff --git a/uts/common/fs/zfs/zcp_synctask.c b/uts/common/fs/zfs/zcp_synctask.c
index 1441a3882a54..25d970ec0888 100644
--- a/uts/common/fs/zfs/zcp_synctask.c
+++ b/uts/common/fs/zfs/zcp_synctask.c
@@ -104,11 +104,11 @@ static zcp_synctask_info_t zcp_synctask_destroy_info = {
.func = zcp_synctask_destroy,
.pargs = {
{.za_name = "filesystem | snapshot", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
{.za_name = "defer", .za_lua_type = LUA_TBOOLEAN},
- {NULL, NULL}
+ {NULL, 0}
},
.space_check = ZFS_SPACE_CHECK_DESTROY,
.blocks_modified = 0
@@ -157,10 +157,10 @@ static zcp_synctask_info_t zcp_synctask_promote_info = {
.func = zcp_synctask_promote,
.pargs = {
{.za_name = "clone", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
},
.space_check = ZFS_SPACE_CHECK_RESERVED,
.blocks_modified = 3
@@ -196,10 +196,10 @@ static zcp_synctask_info_t zcp_synctask_rollback_info = {
.blocks_modified = 1,
.pargs = {
{.za_name = "filesystem", .za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
}
};
@@ -226,10 +226,10 @@ static zcp_synctask_info_t zcp_synctask_snapshot_info = {
.pargs = {
{.za_name = "filesystem@snapname | volume@snapname",
.za_lua_type = LUA_TSTRING},
- {NULL, NULL}
+ {NULL, 0}
},
.kwargs = {
- {NULL, NULL}
+ {NULL, 0}
},
.space_check = ZFS_SPACE_CHECK_NORMAL,
.blocks_modified = 3
diff --git a/uts/common/fs/zfs/zfs_ioctl.c b/uts/common/fs/zfs/zfs_ioctl.c
index 833cc26302ab..b85431ca6e19 100644
--- a/uts/common/fs/zfs/zfs_ioctl.c
+++ b/uts/common/fs/zfs/zfs_ioctl.c
@@ -306,7 +306,7 @@ history_str_get(zfs_cmd_t *zc)
{
char *buf;
- if (zc->zc_history == NULL)
+ if (zc->zc_history == 0)
return (NULL);
buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP);
@@ -2221,7 +2221,7 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc)
* which we aren't supposed to do with a DS_MODE_USER
* hold, because it could be inconsistent.
*/
- if (zc->zc_nvlist_dst != NULL &&
+ if (zc->zc_nvlist_dst != 0 &&
!zc->zc_objset_stats.dds_inconsistent &&
dmu_objset_type(os) == DMU_OST_ZFS) {
nvlist_t *nv;
@@ -2778,7 +2778,7 @@ zfs_ioc_set_prop(zfs_cmd_t *zc)
if (error == 0)
error = zfs_set_prop_nvlist(zc->zc_name, source, nvl, errors);
- if (zc->zc_nvlist_dst != NULL && errors != NULL) {
+ if (zc->zc_nvlist_dst != 0 && errors != NULL) {
(void) put_nvlist(zc, errors);
}
@@ -2929,7 +2929,7 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc)
spa_close(spa, FTAG);
}
- if (error == 0 && zc->zc_nvlist_dst != NULL)
+ if (error == 0 && zc->zc_nvlist_dst != 0)
error = put_nvlist(zc, nvp);
else
error = SET_ERROR(EFAULT);
@@ -4401,7 +4401,7 @@ zfs_ioc_recv(zfs_cmd_t *zc)
tosnap = strchr(tofs, '@');
*tosnap++ = '\0';
- if (zc->zc_nvlist_src != NULL &&
+ if (zc->zc_nvlist_src != 0 &&
(error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size,
zc->zc_iflags, &props)) != 0)
return (error);
@@ -4825,7 +4825,7 @@ zfs_ioc_clear(zfs_cmd_t *zc)
nvlist_t *policy;
nvlist_t *config = NULL;
- if (zc->zc_nvlist_src == NULL)
+ if (zc->zc_nvlist_src == 0)
return (SET_ERROR(EINVAL));
if ((error = get_nvlist(zc->zc_nvlist_src,