path: root/send-stream.c
diff options
authorZach Brown <>2014-08-21 14:24:04 -0700
committerDavid Sterba <>2014-08-22 16:09:55 +0200
commitdace60fc82c10f746a6db89885ef02485fbaaba1 (patch)
tree2e51404f1bf8a78edb164c62f9a90349f42c33a0 /send-stream.c
parent3db4c0a3d35dd5f81a4c1d405ef7f3ca3357ae03 (diff)
btrfs-progs: fix unaligned loads in receive
A user reported corruption after receiving subvolumes. Turning up the logging during the receive showed that the commands and string attributes were being received correctly but the u64 attrbutes were sometimes corrupted by having variable number of low order bytes introduced. It turned out they were on a platform that corrupts unaligned userspace loads. Loading the u64s from the unaligned pointers into the received command stream with get_unaligned() fixed the problem. Reported-By: Klaus Holler <> Tested-By: Klaus Holler <> Signed-off-by: Zach Brown <> Signed-off-by: David Sterba <>
Diffstat (limited to 'send-stream.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/send-stream.c b/send-stream.c
index ef4d8899..10b36b6a 100644
--- a/send-stream.c
+++ b/send-stream.c
@@ -204,7 +204,7 @@ out:
int __len; \
TLV_GET(s, attr, (void**)&__tmp, &__len); \
TLV_CHECK_LEN(sizeof(*__tmp), __len); \
- *v = le##bits##_to_cpu(*__tmp); \
+ *v = get_unaligned_le##bits(__tmp); \
} while (0)
#define TLV_GET_U8(s, attr, v) TLV_GET_INT(s, attr, 8, v)