Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XHsCd-0001yF-TL for mharc-grub-devel@gnu.org; Thu, 14 Aug 2014 06:24:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHsCT-0001wT-6z for grub-devel@gnu.org; Thu, 14 Aug 2014 06:24:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHsCK-0005jY-5W for grub-devel@gnu.org; Thu, 14 Aug 2014 06:24:05 -0400 Received: from mail-oa0-x236.google.com ([2607:f8b0:4003:c02::236]:50558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHsCK-0005jU-09 for grub-devel@gnu.org; Thu, 14 Aug 2014 06:23:56 -0400 Received: by mail-oa0-f54.google.com with SMTP id n16so766550oag.13 for ; Thu, 14 Aug 2014 03:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=QL+V88Z3YfzpROYfKP9GRn/HinihcTKYiQuM8HUfGCs=; b=crAxDKKhBmCGDp81gOBLXxpTyUq4fTBZqIvvMRKJNHoDVTudwTCxHaNxwlpN9BLiuh l5HNL03aWD6Pir40hPJRJLfTbhw7bjCqpf5Fc6QnhdGR2adsWUZxwlZbocCvxxxcE0kp gojPU8O9eIpz1houh4CDwfhWEb4XEuMIo/ycUAbVhScipAmVzevuPttkKYSJ47VQI4Za 6lfiggQiim05m6chLfStGhX8Z5ej3IOmWk6eS1WzTzMJe8NQsZsnQo9oMic3GpZe9iQ7 EO9tJXNW29msvGFXBzA1+s3Yfp4DHEf784AubmYdDQZZqiiYSiP3lqIWMPp/YXVLEmdh Usyw== X-Received: by 10.182.231.170 with SMTP id th10mr11551090obc.8.1408011835116; Thu, 14 Aug 2014 03:23:55 -0700 (PDT) Received: from localhost.localdomain ([130.57.30.250]) by mx.google.com with ESMTPSA id of8sm5143191obb.25.2014.08.14.03.23.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Aug 2014 03:23:54 -0700 (PDT) Sender: =?UTF-8?B?5by15paH6I+v?= From: Michael Chang To: grub-devel@gnu.org Subject: [PATCH] Fix incorrect address reference in btrfs Date: Thu, 14 Aug 2014 18:17:45 +0800 Message-Id: <1408011465-25794-1-git-send-email-mchang@suse.com> X-Mailer: git-send-email 1.7.3.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::236 Cc: Michael Chang X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 10:24:14 -0000 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