Fix incorrect address reference in btrfs
PATCH 1/1 Fix incorrect address reference in btrfs
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_entent_data structure correctly, not the pointer variable to it.
Any suggestions to this patch is welcome.
--- grub-core/fs/btrfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
grub-core/fs/btrfs.c +1 -1
@@ -1051,7 +1051,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data, 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);
Signature · 1 line
1.7.3.4
CC Takashi and Jeff
Quoted 35 lines · Michael Chang
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_REGULARand the entire result is unpredictable.This is a quick fix to make the address reference to the
grub_btrfs_entent_datastructure correctly, not the pointer variable to it.Any suggestions to this patch is welcome.
--- grub-core/fs/btrfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)grub-core/fs/btrfs.c +1
-1@@ -1051,7 +1051,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data, 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);Signature · 7 lines
1.7.3.4 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 11 lines · Michael Chang
Quoted 10 lines · Michael Chang
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_REGULARand the entire result is unpredictable.This is a quick fix to make the address reference to the
grub_btrfs_entent_datastructure correctly, not the pointer variable to it.Any suggestions to this patch is welcome.
Looks good to me, thanks. Added a ChangeLog entry and pushed to master.
Signature · 1 line
Colin Watson [[email protected]]