From 9d47dec0481d8cd53b2c1053c96bfa3f78357d6a Mon Sep 17 00:00:00 2001 From: "Justin T. Gibbs" Date: Tue, 3 Feb 2015 18:33:00 -0700 Subject: [PATCH] 5592 NULL pointer dereference in dsl_prop_notify_all_cb() Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Will Andrews Approved by: Robert Mustacchi --- usr/src/uts/common/fs/zfs/dsl_dataset.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/usr/src/uts/common/fs/zfs/dsl_dataset.c b/usr/src/uts/common/fs/zfs/dsl_dataset.c index ba9c766c65f6..b4ab4ec3fd41 100644 --- a/usr/src/uts/common/fs/zfs/dsl_dataset.c +++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c @@ -363,8 +363,19 @@ dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx, boolean_t dsl_dataset_try_add_ref(dsl_pool_t *dp, dsl_dataset_t *ds, void *tag) { - return (dmu_buf_try_add_ref(ds->ds_dbuf, dp->dp_meta_objset, - ds->ds_object, DMU_BONUS_BLKID, tag)); + dmu_buf_t *dbuf = ds->ds_dbuf; + boolean_t result = B_FALSE; + + if (dbuf != NULL && dmu_buf_try_add_ref(dbuf, dp->dp_meta_objset, + ds->ds_object, DMU_BONUS_BLKID, tag)) { + + if (ds == dmu_buf_get_user(dbuf)) + result = B_TRUE; + else + dmu_buf_rele(dbuf, tag); + } + + return (result); } int