]> granicus.if.org Git - zfs/commitdiff
receive_spill does not byte swap spill contents
authorPaul Zuchowski <31706010+PaulZ-98@users.noreply.github.com>
Thu, 15 Mar 2018 17:29:51 +0000 (13:29 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 15 Mar 2018 17:29:51 +0000 (10:29 -0700)
In zfs receive, the function receive_spill should account
for spill block endian conversion as a defensive measure.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #7300

module/zfs/dmu_send.c

index f5894e6b8d0c4720a15963965a654a5ca5ca6c08..d39ab1a9eafee8edbef88810f17629324862f2d2 100644 (file)
@@ -2977,6 +2977,15 @@ receive_spill(struct receive_writer_arg *rwa, struct drr_spill *drrs,
        if (db_spill->db_size < drrs->drr_length)
                VERIFY(0 == dbuf_spill_set_blksz(db_spill,
                    drrs->drr_length, tx));
+
+       if (rwa->byteswap && !arc_is_encrypted(abuf) &&
+           arc_get_compression(abuf) == ZIO_COMPRESS_OFF) {
+               dmu_object_byteswap_t byteswap =
+                   DMU_OT_BYTESWAP(drrs->drr_type);
+               dmu_ot_byteswap[byteswap].ob_func(abuf->b_data,
+                   DRR_SPILL_PAYLOAD_SIZE(drrs));
+       }
+
        dbuf_assign_arcbuf((dmu_buf_impl_t *)db_spill, abuf, tx);
 
        dmu_buf_rele(db, FTAG);