fs/f2fs: Set a grub_errno if mount fails
authorB Horn <b@horn.uk>
Sun, 12 May 2024 05:15:03 +0000 (06:15 +0100)
committerFelix Zielcke <fzielcke@z-51.de>
Wed, 11 Jun 2025 15:42:34 +0000 (17:42 +0200)
It was previously possible for grub_errno to not be set when
grub_f2fs_mount() failed if nat_bitmap_ptr() returned NULL.

This issue is solved by ensuring a grub_errno is set in the fail case.

Reported-by: B Horn <b@horn.uk>
Signed-off-by: B Horn <b@horn.uk>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Gbp-Pq: Topic cve-2025-jan
Gbp-Pq: Name fs-f2fs-Set-a-grub_errno-if-mount-fails.patch

grub-core/fs/f2fs.c

index 855e24618c2bc3a11fc8c630f9c6405c1f8c44d2..db8a65f8d56b6edd948ff7c2183c73c4013c1f6d 100644 (file)
@@ -872,6 +872,9 @@ grub_f2fs_mount (grub_disk_t disk)
   return data;
 
  fail:
+  if (grub_errno == GRUB_ERR_NONE)
+    grub_error (GRUB_ERR_BAD_FS, "not a F2FS filesystem");
+
   grub_free (data);
 
   return NULL;