summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schwarz <[email protected]>2020-01-24 06:13:42 +0100
committerBrian Behlendorf <[email protected]>2020-01-23 21:13:42 -0800
commit20ea8540a68ff183f273fc642ac498ccd182d58e (patch)
tree8f17386f54c9e9409a38e2595c49811b7490c38b
parent3aea3c9d548b1788ec0eb88d43a7aa33b8c4fcf1 (diff)
dsl_bookmark_create_check: fix NULL pointer deref if dbca_errors == NULL
Discovered in preparation of zcp support for creating bookmarks. Handle the case where dbca_errors is NULL. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Christian Schwarz <[email protected]> Closes #9880
-rw-r--r--module/zfs/dsl_bookmark.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/module/zfs/dsl_bookmark.c b/module/zfs/dsl_bookmark.c
index 42c612abc..4d5c601d6 100644
--- a/module/zfs/dsl_bookmark.c
+++ b/module/zfs/dsl_bookmark.c
@@ -167,6 +167,9 @@ static int
dsl_bookmark_create_check(void *arg, dmu_tx_t *tx)
{
dsl_bookmark_create_arg_t *dbca = arg;
+ ASSERT3P(dbca, !=, NULL);
+ ASSERT3P(dbca->dbca_bmarks, !=, NULL);
+
dsl_pool_t *dp = dmu_tx_pool(tx);
int rv = 0;
@@ -187,9 +190,10 @@ dsl_bookmark_create_check(void *arg, dmu_tx_t *tx)
dsl_dataset_rele(snapds, FTAG);
}
if (error != 0) {
- fnvlist_add_int32(dbca->dbca_errors,
- nvpair_name(pair), error);
rv = error;
+ if (dbca->dbca_errors != NULL)
+ fnvlist_add_int32(dbca->dbca_errors,
+ nvpair_name(pair), error);
}
}