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 <behlendorf1@llnl.gov>
Signed-off-by: Christian Schwarz <me@cschwarz.com>
Closes #9880
This commit is contained in:
Christian Schwarz 2020-01-24 06:13:42 +01:00 committed by Brian Behlendorf
parent 3aea3c9d54
commit 20ea8540a6

View File

@ -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);
}
}