All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bug fix for ext2.c
@ 2009-03-14 16:16 Bean
  2009-03-14 16:37 ` Robert Millan
  2009-03-14 21:27 ` Yoshinori K. Okuji
  0 siblings, 2 replies; 11+ messages in thread
From: Bean @ 2009-03-14 16:16 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

Hi,

I've discovered a bug in ext2.c, inside grub_ext2_mount. The mount
function must return GRUB_ERR_BAD_FS if something goes wrong, because
grub_fs_probe would stop as soon as it sees a non-GRUB_ERR_BAD_FS
error, thus preventing other fs driver from detecting the correct fs
type. This patch fixes the problem.

-- 
Bean

[-- Attachment #2: ext2.diff --]
[-- Type: application/octet-stream, Size: 943 bytes --]

diff --git a/fs/ext2.c b/fs/ext2.c
index ac0757e..aad1384 100644
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -548,17 +548,14 @@ grub_ext2_mount (grub_disk_t disk)
 
   /* Make sure this is an ext2 filesystem.  */
   if (grub_le_to_cpu16 (data->sblock.magic) != EXT2_MAGIC)
-    {
-      grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
-      goto fail;
-    }
+    goto fail;
   
   /* Check the FS doesn't have feature bits enabled that we don't support. */
   if (grub_le_to_cpu32 (data->sblock.feature_incompat)
         & ~(EXT2_DRIVER_SUPPORTED_INCOMPAT | EXT2_DRIVER_IGNORED_INCOMPAT))
     {
       grub_error (GRUB_ERR_BAD_FS, "filesystem has unsupported incompatible features");
-      goto fail;
+      goto fail_1;
     }
     
   
@@ -576,7 +573,10 @@ grub_ext2_mount (grub_disk_t disk)
   
   return data;
 
- fail:
+fail:
+  grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
+ 
+fail_1:
   grub_free (data);
   return 0;
 }

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-03-21  7:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-14 16:16 [PATCH] Bug fix for ext2.c Bean
2009-03-14 16:37 ` Robert Millan
2009-03-14 16:56   ` Bean
2009-03-14 17:35     ` Robert Millan
2009-03-14 17:47       ` Bean
2009-03-14 21:27 ` Yoshinori K. Okuji
2009-03-15  6:00   ` Bean
2009-03-15 10:33     ` Felix Zielcke
2009-03-15 15:37       ` Robert Millan
2009-03-17  5:47         ` Bean
2009-03-21  7:35           ` Bean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.