We encountered a weird random kernel initrd unpacking error on btrfs
and finally found it was caused by incorrect address reference in range
check for type GRUB_BTRFS_EXTENT_REGULAR and the entire result is
unpredictable.
This is a quick fix to make the address reference to the
grub_btrfs_extent_data structure correctly, not the pointer variable
to it.
Any suggestions to this patch is welcome.
+2014-09-08 Michael Chang <mchang@suse.com>
+
+ * grub-core/fs/btrfs.c (grub_btrfs_extent_read): Fix extent size
+ check; comparing &data->extent against addresses in the region it
+ points to is unpredictable.
+
2014-09-07 Colin Watson <cjwatson@ubuntu.com>
Support grub-emu on x32 (ILP32 but with x86-64 instruction set)
data->extend = data->extstart + grub_le_to_cpu64 (data->extent->size);
if (data->extent->type == GRUB_BTRFS_EXTENT_REGULAR
- && (char *) &data->extent + elemsize
+ && (char *) data->extent + elemsize
>= (char *) &data->extent->filled + sizeof (data->extent->filled))
data->extend =
data->extstart + grub_le_to_cpu64 (data->extent->filled);