summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZiran Zhang <zhangcoder@yeah.net>2026-04-12 14:59:41 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-08-03 21:10:14 -0700
commitbc96ad381f05668123ce6fe760ad3a370fbf35ea (patch)
treee1968b99e21ec45cbfad1dd0377aa5ec136de72a
parent0a2418c32734e5fd657d74b3a9598746e5a1f4f4 (diff)
FAT: allow 0xE9 near jump in fat_read_static_bpb()
fat_read_static_bpb() only accepts a short jump as a valid bootstrap code signature for DOS 1.x volumes when the dos1xfloppy mount option is used. However, according to the Microsoft fatgen103.doc, the BS_jmpBoot field has two allowed forms: 0xEB 0x?? 0x90 (short jump + NOP) and 0xE9 0x?? 0x?? (near jump). The specification explicitly states that either form is acceptable. This patch relaxes the check to also accept 0xE9 as the first byte of the jump instruction. Link: https://lore.kernel.org/20260412070109.5197-1-zhangcoder@yeah.net Signed-off-by: Ziran Zhang <zhangcoder@yeah.net> Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Christian Brauner <brauner@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--fs/fat/inode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 3aa52481ad5c..d1e6c9b2f9df 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1479,8 +1479,9 @@ static int fat_read_static_bpb(struct super_block *sb,
int error = -EINVAL;
unsigned i;
- /* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */
- if (b->ignored[0] != 0xeb || b->ignored[2] != 0x90) {
+ /* 16-bit DOS 1.x reliably wrote bootstrap short-jmp or near-jmp code */
+ if ((b->ignored[0] != 0xeb || b->ignored[2] != 0x90) &&
+ (b->ignored[0] != 0xe9)) {
if (!silent)
fat_msg(sb, KERN_ERR,
"%s; no bootstrapping code", notdos1x);