summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Clark <[email protected]>2013-07-23 13:32:57 -0400
committerBrian Behlendorf <[email protected]>2013-08-01 09:48:07 -0700
commit7d63721118a82a29649a3d8ae4b4522afdad1449 (patch)
tree2aa0edd1b90d7df9baedd563f883c6805b000ff7
parentcb543e6b5e98546a5caec29ca4b25abec98560a2 (diff)
dmu_tx: Fix possible NULL pointer dereference
dmu_tx_hold_object_impl can return NULL on error. Check for this condition prior to dereferencing pointer. This can only occur if the passed object was invalid or unallocated. Signed-off-by: Nathaniel Clark <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1610
-rw-r--r--module/zfs/dmu_tx.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c
index b0dc64f06..fd714135a 100644
--- a/module/zfs/dmu_tx.c
+++ b/module/zfs/dmu_tx.c
@@ -773,12 +773,13 @@ void
dmu_tx_hold_space(dmu_tx_t *tx, uint64_t space)
{
dmu_tx_hold_t *txh;
+
ASSERT(tx->tx_txg == 0);
txh = dmu_tx_hold_object_impl(tx, tx->tx_objset,
DMU_NEW_OBJECT, THT_SPACE, space, 0);
-
- txh->txh_space_towrite += space;
+ if (txh)
+ txh->txh_space_towrite += space;
}
int
@@ -1320,6 +1321,8 @@ dmu_tx_hold_spill(dmu_tx_t *tx, uint64_t object)
txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, object,
THT_SPILL, 0, 0);
+ if (txh == NULL)
+ return;
dn = txh->txh_dnode;