* [PATCH] Fix incorrect address reference in btrfs
@ 2014-08-14 10:17 Michael Chang
2014-08-14 10:50 ` Michael Chang
0 siblings, 1 reply; 3+ messages in thread
From: Michael Chang @ 2014-08-14 10:17 UTC (permalink / raw)
To: grub-devel; +Cc: 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_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(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index f7b6c15..95a8fa6 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -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);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix incorrect address reference in btrfs
2014-08-14 10:17 [PATCH] Fix incorrect address reference in btrfs Michael Chang
@ 2014-08-14 10:50 ` Michael Chang
2014-09-08 10:34 ` Colin Watson
0 siblings, 1 reply; 3+ messages in thread
From: Michael Chang @ 2014-08-14 10:50 UTC (permalink / raw)
To: grub-devel; +Cc: Takashi Iwai, Jeff Mahoney
CC Takashi and Jeff
On Thu, Aug 14, 2014 at 06:17:45PM +0800, Michael Chang wrote:
> 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(-)
>
> diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
> index f7b6c15..95a8fa6 100644
> --- a/grub-core/fs/btrfs.c
> +++ b/grub-core/fs/btrfs.c
> @@ -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);
> --
> 1.7.3.4
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix incorrect address reference in btrfs
2014-08-14 10:50 ` Michael Chang
@ 2014-09-08 10:34 ` Colin Watson
0 siblings, 0 replies; 3+ messages in thread
From: Colin Watson @ 2014-09-08 10:34 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: Takashi Iwai, Jeff Mahoney
On Thu, Aug 14, 2014 at 06:50:00PM +0800, Michael Chang wrote:
> On Thu, Aug 14, 2014 at 06:17:45PM +0800, Michael Chang wrote:
> > 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.
Looks good to me, thanks. Added a ChangeLog entry and pushed to master.
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-08 10:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-14 10:17 [PATCH] Fix incorrect address reference in btrfs Michael Chang
2014-08-14 10:50 ` Michael Chang
2014-09-08 10:34 ` Colin Watson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).