diff options
author | Tom Caputi <[email protected]> | 2019-01-17 18:47:08 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-01-17 15:47:08 -0800 |
commit | 305781da4bbe11acef8707894d7e33f8aef3ca8e (patch) | |
tree | 3ac436d2d8c1fe88daee63964e838bdab9f63cd2 /module/zfs/dmu_recv.c | |
parent | 75058f33034d23801818582996d3dc941c545910 (diff) |
Fix error handling incallers of dbuf_hold_level()
Currently, the functions dbuf_prefetch_indirect_done() and
dmu_assign_arcbuf_by_dnode() assume that dbuf_hold_level() cannot
fail. In the event of an error the former will cause a NULL pointer
dereference and the later will trigger a VERIFY. This patch adds
error handling to these functions and their callers where necessary.
Reviewed by: Matt Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tom Caputi <[email protected]>
Closes #8291
Diffstat (limited to 'module/zfs/dmu_recv.c')
-rw-r--r-- | module/zfs/dmu_recv.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c index a448bc148..257f157fd 100644 --- a/module/zfs/dmu_recv.c +++ b/module/zfs/dmu_recv.c @@ -1439,7 +1439,12 @@ receive_write(struct receive_writer_arg *rwa, struct drr_write *drrw, } VERIFY0(dnode_hold(rwa->os, drrw->drr_object, FTAG, &dn)); - dmu_assign_arcbuf_by_dnode(dn, drrw->drr_offset, abuf, tx); + err = dmu_assign_arcbuf_by_dnode(dn, drrw->drr_offset, abuf, tx); + if (err != 0) { + dnode_rele(dn, FTAG); + dmu_tx_commit(tx); + return (err); + } dnode_rele(dn, FTAG); /* |