From nobody Tue Jun 16 20:39:29 2026 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6CD73EC2F3 for ; Wed, 29 Apr 2026 10:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777459473; cv=none; b=nBQ+rucis1Wy7xu6jLC2I/DykUWHERawM3McVGvzdnk7hRWB/fXrzxRgmNiaxOEPzne6eRIieDVIi0+NesWTVtu39HMB8LFm6laLgaKawGKZfWyPJFmrvochwjJg90Lsb59cXIGuBBaXZ1f4xeYrGJH+eQiOwzjwzcjtWury2+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777459473; c=relaxed/simple; bh=2xoTMSmS8N0bc/QyMBrYAClp3eUSU+Fatn/Q8UlPSjg=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:Content-Type; b=Zs2ih0vz5iqyBPNxMWN6uGKyY5kziDtXr37VB3oMPj/U80Hq8UvWuJq6nUEFa2B+vJ2I8jJa/rY298KikMZwF2UNZ71zxWeT1yy1/iTyI+VlsO0htpFBBnP6laePZzSBvaHEmPRFMFG4moRBPPDEZD1gKlmdnWRxOwaCDAh9sM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 63TAiE68032899; Wed, 29 Apr 2026 19:44:14 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from [192.168.1.5] (M106072072000.v4.enabler.ne.jp [106.72.72.0]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 63TAiEXt032895 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Wed, 29 Apr 2026 19:44:14 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <329e1951-0704-4d90-aeeb-ffc7123f4262@I-love.SAKURA.ne.jp> Date: Wed, 29 Apr 2026 19:44:13 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Tetsuo Handa Subject: [PATCH v2] hpfs: obsolete check=none mount option To: Linus Torvalds Cc: Mikulas Patocka , Deepanshu Kartikey , LKML Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Virus-Status: clean X-Anti-Virus-Server: fsav201.rs.sakura.ne.jp Content-Type: text/plain; charset="utf-8" syzbot is reporting use-after-free read problems when a crafted HPFS image was mounted with "check=3Dnone" option. The "check=3Dnone" option is intended for only users who want maximum speed and use the filesystem only on trusted input. But fuzzers are for testing the filesystem on untrusted input. Mikulas Patocka (the HPFS maintainer) was thinking that there is no need to add some middle ground where "check=3Dnone" would check some structures and won't check others [1]. Therefore, I proposed guarding "check=3Dnone" using a kernel config option [2]. Then, Mikulas came to think that "check=3Dnone" is not required at all because HPFS is not considered 'high-performance' anymore [3], and sent a pull request [4] that changes "check=3Dnone" to be interpreted as "check=3Dnormal". But Linus Torvalds raised a question instead of accepting that pull request [5]. Although Mikulas answered to the question from Linus, discussion died there. Now, Mikulas again came to think that we should update the fuzzers not to use the "check=3Dnone" option [6]. But since it seems that syzkaller has invented a way to change printk() loglevel [7], I don't think that fuzzers won't find a way to do "mount -o remount,check=3Dnone /path/to/hpfs" reques= t. Since no message is printed when "check=3Dnone" is specified upon remount, we won't be able to prove that fuzzers are not using "check=3Dnone" option. Unless we guard using a kernel config option [2] or change interpretation of "check=3Dnone" option [4] or remove "check=3Dnone" behavior (this patch), the only way we can prove that "check=3Dnone" is not the cause when crash happened will be to build kernels without HPFS support. (Maybe we can migrate HPFS to FUSE-based implementation given that HPFS is not considered 'high-performance' anymore...) This patch does not eliminate "check=3Dnone" option itself in order not to break existing scripts or /etc/fstab configurations that people may have. This patch instead eliminates sb_chk !=3D 0 test that becomes redundant. But in order to keep this patch minimal, this patch does not fix coding style problems. Reported-by: syzbot+fa88eb476e42878f2844@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Dfa88eb476e42878f2844 Reported-by: syzbot+8debf4b3f7c7391cd8eb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D8debf4b3f7c7391cd8eb Link: https://lore.kernel.org/all/9ca81125-1c7b-ddaf-09ea-638bc5712632@redh= at.com/ [1] Link: https://lore.kernel.org/all/51bdd056-61dd-4b57-8780-324b2f8bc99f@I-lo= ve.SAKURA.ne.jp/ [2] Link: https://lore.kernel.org/all/31825fd6-45b8-928f-0022-0696202032ce@twib= right.com/ [3] Link: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-d= m.git/commit/?h=3Dfor-6.20/hpfs-changes&id=3Da4664a2bc61c2abbc772df9139da9d= bd2b26dc7f [4] Link: https://lore.kernel.org/all/0a4797ab-07a5-11ef-074f-19ad637f84ea@redh= at.com/ [5] Link: https://lore.kernel.org/all/2fab64ca-c9e6-4d67-1af9-76c816aeb074@twib= right.com/ [6] Link: https://lore.kernel.org/all/4d1a4b51-999b-63c6-5ce3-a704013cecb6@i-lo= ve.sakura.ne.jp/ [7] Signed-off-by: Tetsuo Handa --- The kernel test robot will respond to this patch about unsafe behavior ( https://lore.kernel.org/oe-kbuild-all/202602272252.89OlLXUV-lkp@intel.com= / ), but these warnings are not caused by this patch because this patch eliminat= es only sb_chk !=3D 0 test. Fixing coding styles and possible unsafe behavior are up to future patches. Linus, please respond with which approach is acceptable for you. fs/hpfs/alloc.c | 4 ++-- fs/hpfs/anode.c | 13 ++++--------- fs/hpfs/dir.c | 5 ++--- fs/hpfs/dnode.c | 19 ++++--------------- fs/hpfs/map.c | 14 +++++++------- fs/hpfs/super.c | 10 +++++----- 6 files changed, 24 insertions(+), 41 deletions(-) diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c index 66617b1557c6..a821dbd4e8cd 100644 --- a/fs/hpfs/alloc.c +++ b/fs/hpfs/alloc.c @@ -178,7 +178,7 @@ static secno alloc_in_bmp(struct super_block *s, secno = near, unsigned n, unsigne } while (i !=3D nr); rt: if (ret) { - if (hpfs_sb(s)->sb_chk && ((ret >> 14) !=3D (bs >> 14) || (le32_to_cpu(b= mp[(ret & 0x3fff) >> 5]) | ~(((1 << n) - 1) << (ret & 0x1f))) !=3D 0xffffff= ff)) { + if (((ret >> 14) !=3D (bs >> 14) || (le32_to_cpu(bmp[(ret & 0x3fff) >> 5= ]) | ~(((1 << n) - 1) << (ret & 0x1f))) !=3D 0xffffffff)) { hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", = n, ret); ret =3D 0; goto b; @@ -404,7 +404,7 @@ int hpfs_check_free_dnodes(struct super_block *s, int n) =20 void hpfs_free_dnode(struct super_block *s, dnode_secno dno) { - if (hpfs_sb(s)->sb_chk) if (dno & 3) { + if (dno & 3) { hpfs_error(s, "hpfs_free_dnode: dnode %08x not aligned", dno); return; } diff --git a/fs/hpfs/anode.c b/fs/hpfs/anode.c index a4f5321eafae..efa534cd7abc 100644 --- a/fs/hpfs/anode.c +++ b/fs/hpfs/anode.c @@ -20,7 +20,7 @@ secno hpfs_bplus_lookup(struct super_block *s, struct ino= de *inode, int i; int c1, c2 =3D 0; go_down: - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_= lookup")) return -1; + if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_lookup")) return -1; if (bp_internal(btree)) { for (i =3D 0; i < btree->n_used_nodes; i++) if (le32_to_cpu(btree->u.internal[i].file_secno) > sec) { @@ -38,7 +38,7 @@ secno hpfs_bplus_lookup(struct super_block *s, struct ino= de *inode, if (le32_to_cpu(btree->u.external[i].file_secno) <=3D sec && le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.= external[i].length) > sec) { a =3D le32_to_cpu(btree->u.external[i].disk_secno) + sec - le32_to_cpu(= btree->u.external[i].file_secno); - if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, a, 1, "data")) { + if (hpfs_chk_sectors(s, a, 1, "data")) { brelse(bh); return -1; } @@ -89,7 +89,6 @@ secno hpfs_add_sector_to_btree(struct super_block *s, sec= no node, int fnod, unsi btree->u.internal[n].file_secno =3D cpu_to_le32(-1); mark_buffer_dirty(bh); brelse(bh); - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_add_sector_to_btree #1")) re= turn -1; if (!(anode =3D hpfs_map_anode(s, a, &bh))) return -1; btree =3D GET_BTREE_PTR(&anode->btree); @@ -165,7 +164,6 @@ secno hpfs_add_sector_to_btree(struct super_block *s, s= ecno node, int fnod, unsi c2 =3D 0; while (up !=3D (anode_secno)-1) { struct anode *new_anode; - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, up, &c1, &c2, "hpfs_add_sector_to_btree #2")) r= eturn -1; if (up !=3D node || !fnod) { if (!(anode =3D hpfs_map_anode(s, up, &bh))) return -1; @@ -288,7 +286,6 @@ void hpfs_remove_btree(struct super_block *s, struct bp= lus_header *btree) while (bp_internal(btree1)) { ano =3D le32_to_cpu(btree1->u.internal[pos].down); if (level) brelse(bh); - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, ano, &d1, &d2, "hpfs_remove_btree #1")) return; if (!(anode =3D hpfs_map_anode(s, ano, &bh))) return; @@ -301,7 +298,6 @@ void hpfs_remove_btree(struct super_block *s, struct bp= lus_header *btree) go_up: if (!level) return; brelse(bh); - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, ano, &c1, &c2, "hpfs_remove_btree #2")) return; hpfs_free_sectors(s, ano, 1); oano =3D ano; @@ -348,7 +344,7 @@ int hpfs_ea_read(struct super_block *s, secno a, int an= o, unsigned pos, if ((sec =3D anode_lookup(s, a, pos >> 9)) =3D=3D -1) return -1; } else sec =3D a + (pos >> 9); - if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, sec, 1, "ea #1")) return= -1; + if (hpfs_chk_sectors(s, sec, 1, "ea #1")) return -1; if (!(data =3D hpfs_map_sector(s, sec, &bh, (len - 1) >> 9))) return -1; l =3D 0x200 - (pos & 0x1ff); if (l > len) l =3D len; @@ -371,7 +367,7 @@ int hpfs_ea_write(struct super_block *s, secno a, int a= no, unsigned pos, if ((sec =3D anode_lookup(s, a, pos >> 9)) =3D=3D -1) return -1; } else sec =3D a + (pos >> 9); - if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, sec, 1, "ea #2")) return= -1; + if (hpfs_chk_sectors(s, sec, 1, "ea #2")) return -1; if (!(data =3D hpfs_map_sector(s, sec, &bh, (len - 1) >> 9))) return -1; l =3D 0x200 - (pos & 0x1ff); if (l > len) l =3D len; @@ -445,7 +441,6 @@ void hpfs_truncate_btree(struct super_block *s, secno f= , int fno, unsigned secs) } node =3D le32_to_cpu(btree->u.internal[i].down); brelse(bh); - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, node, &c1, &c2, "hpfs_truncate_btree")) return; if (!(anode =3D hpfs_map_anode(s, node, &bh))) return; diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 3bf11202e2d3..e49a789b0f9a 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c @@ -76,7 +76,7 @@ static int hpfs_readdir(struct file *file, struct dir_con= text *ctx) =20 hpfs_lock(inode->i_sb); =20 - if (hpfs_sb(inode->i_sb)->sb_chk) { + { if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) { ret =3D -EFSERROR; goto out; @@ -124,7 +124,6 @@ static int hpfs_readdir(struct file *file, struct dir_c= ontext *ctx) /* This won't work when cycle is longer than number of dirents accepted by filldir, but what can I do? maybe killall -9 ls helps */ - if (hpfs_sb(inode->i_sb)->sb_chk) if (hpfs_stop_cycles(inode->i_sb, ctx->pos, &c1, &c2, "hpfs_readdir")) { ret =3D -EFSERROR; goto out; @@ -158,7 +157,7 @@ static int hpfs_readdir(struct file *file, struct dir_c= ontext *ctx) goto out; } if (de->first || de->last) { - if (hpfs_sb(inode->i_sb)->sb_chk) { + { if (de->first && !de->last && (de->namelen !=3D 2 || de ->name[0] !=3D 1 || de->name[1] !=3D 1)) hpfs_error(inode->i_sb, "hpfs_readdir: bad ^A^A entry; pos =3D %08lx"= , (unsigned long)ctx->pos); diff --git a/fs/hpfs/dnode.c b/fs/hpfs/dnode.c index 8c6aa060fd87..ad160d931de8 100644 --- a/fs/hpfs/dnode.c +++ b/fs/hpfs/dnode.c @@ -144,7 +144,7 @@ static void set_last_pointer(struct super_block *s, str= uct dnode *d, dnode_secno hpfs_error(s, "set_last_pointer: empty dnode %08x", le32_to_cpu(d->self)= ); return; } - if (hpfs_sb(s)->sb_chk) { + { if (de->down) { hpfs_error(s, "set_last_pointer: dnode %08x has already last pointer %0= 8x", le32_to_cpu(d->self), de_down_pointer(de)); @@ -266,7 +266,6 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_sec= no dno, return 1; } go_up_a: - if (hpfs_sb(i->i_sb)->sb_chk) if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) { hpfs_brelse4(&qbh); kfree(nd); @@ -397,7 +396,6 @@ int hpfs_add_dirent(struct inode *i, int c1, c2 =3D 0; dno =3D hpfs_inode->i_dno; down: - if (hpfs_sb(i->i_sb)->sb_chk) if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_dirent")) return = 1; if (!(d =3D hpfs_map_dnode(i->i_sb, dno, &qbh))) return 1; de_end =3D dnode_end_de(d); @@ -442,11 +440,10 @@ static secno move_to_top(struct inode *i, dnode_secno= from, dnode_secno to) int c1, c2 =3D 0; dno =3D from; while (1) { - if (hpfs_sb(i->i_sb)->sb_chk) if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "move_to_top")) return 0; if (!(dnode =3D hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0; - if (hpfs_sb(i->i_sb)->sb_chk) { + { if (le32_to_cpu(dnode->up) !=3D chk_up) { hpfs_error(i->i_sb, "move_to_top: up pointer from %08x should be %08x,= is %08x", dno, chk_up, le32_to_cpu(dnode->up)); @@ -534,7 +531,7 @@ static void delete_empty_dnode(struct inode *i, dnode_s= ecno dno) up =3D le32_to_cpu(dnode->up); de =3D dnode_first_de(dnode); down =3D de->down ? de_down_pointer(de) : 0; - if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) { + if (root && !down) { hpfs_error(i->i_sb, "delete_empty_dnode: root dnode %08x is empty", dno= ); goto end; } @@ -547,7 +544,6 @@ static void delete_empty_dnode(struct inode *i, dnode_s= ecno dno) struct buffer_head *bh; struct dnode *d1; struct quad_buffer_head qbh1; - if (hpfs_sb(i->i_sb)->sb_chk) if (up !=3D i->i_ino) { hpfs_error(i->i_sb, "bad pointer to fnode, dnode %08x, pointing to %08x, should be %0= 8llx", @@ -751,12 +747,11 @@ void hpfs_count_dnodes(struct super_block *s, dnode_s= ecno dno, int *n_dnodes, int d1, d2 =3D 0; go_down: if (n_dnodes) (*n_dnodes)++; - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, dno, &c1, &c2, "hpfs_count_dnodes #1")) return; ptr =3D 0; go_up: if (!(dnode =3D hpfs_map_dnode(s, dno, &qbh))) return; - if (hpfs_sb(s)->sb_chk) if (odno && odno !=3D -1 && le32_to_cpu(dnode->up= ) !=3D odno) + if (odno && odno !=3D -1 && le32_to_cpu(dnode->up) !=3D odno) hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x = points to %08x", odno, dno, le32_to_cpu(dnode->up)); de =3D dnode_first_de(dnode); if (ptr) while(1) { @@ -787,7 +782,6 @@ void hpfs_count_dnodes(struct super_block *s, dnode_sec= no dno, int *n_dnodes, return; } hpfs_brelse4(&qbh); - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, ptr, &d1, &d2, "hpfs_count_dnodes #2")) return; odno =3D -1; goto go_up; @@ -824,11 +818,9 @@ dnode_secno hpfs_de_as_down_as_possible(struct super_b= lock *s, dnode_secno dno) int c1, c2 =3D 0; =20 again: - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, d, &c1, &c2, "hpfs_de_as_down_as_possible")) return d; if (!(de =3D map_nth_dirent(s, d, 1, &qbh, NULL))) return dno; - if (hpfs_sb(s)->sb_chk) if (up && le32_to_cpu(((struct dnode *)qbh.data)->up) !=3D up) hpfs_error(s, "hpfs_de_as_down_as_possible: bad up pointer; dnode %08x,= down %08x points to %08x", up, d, le32_to_cpu(((struct dnode *)qbh.data)->= up)); if (!de->down) { @@ -917,7 +909,6 @@ struct hpfs_dirent *map_dirent(struct inode *inode, dno= de_secno dno, =20 if (!S_ISDIR(inode->i_mode)) hpfs_error(inode->i_sb, "map_dirent: not a d= irectory\n"); again: - if (hpfs_sb(inode->i_sb)->sb_chk) if (hpfs_stop_cycles(inode->i_sb, dno, &c1, &c2, "map_dirent")) return N= ULL; if (!(dnode =3D hpfs_map_dnode(inode->i_sb, dno, qbh))) return NULL; =09 @@ -1062,7 +1053,6 @@ struct hpfs_dirent *map_fnode_dirent(struct super_blo= ck *s, fnode_secno fno, if (c < 0 && de->down) { dno =3D de_down_pointer(de); hpfs_brelse4(qbh); - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, dno, &c1, &c2, "map_fnode_dirent #1")) { kfree(name2); return NULL; @@ -1081,7 +1071,6 @@ struct hpfs_dirent *map_fnode_dirent(struct super_blo= ck *s, fnode_secno fno, downd =3D dno; dno =3D le32_to_cpu(d->up); hpfs_brelse4(qbh); - if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, downd, &d1, &d2, "map_fnode_dirent #2")) { kfree(name2); return NULL; diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c index be73233502f8..eeb8ff9b34bb 100644 --- a/fs/hpfs/map.c +++ b/fs/hpfs/map.c @@ -20,7 +20,7 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned b= mp_block, secno sec; __le32 *ret; unsigned n_bands =3D (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; - if (hpfs_sb(s)->sb_chk) if (bmp_block >=3D n_bands) { + if (bmp_block >=3D n_bands) { hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", b= mp_block, id); return NULL; } @@ -164,11 +164,11 @@ void hpfs_load_hotfix_map(struct super_block *s, stru= ct hpfs_spare_block *spareb struct fnode *hpfs_map_fnode(struct super_block *s, ino_t ino, struct buff= er_head **bhp) { struct fnode *fnode; - if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, ino, 1, "fnode")) { + if (hpfs_chk_sectors(s, ino, 1, "fnode")) { return NULL; } if ((fnode =3D hpfs_map_sector(s, ino, bhp, FNODE_RD_AHEAD))) { - if (hpfs_sb(s)->sb_chk) { + { struct extended_attribute *ea; struct extended_attribute *ea_end; if (le32_to_cpu(fnode->magic) !=3D FNODE_MAGIC) { @@ -221,9 +221,9 @@ struct fnode *hpfs_map_fnode(struct super_block *s, ino= _t ino, struct buffer_hea struct anode *hpfs_map_anode(struct super_block *s, anode_secno ano, struc= t buffer_head **bhp) { struct anode *anode; - if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, ano, 1, "anode")) return = NULL; + if (hpfs_chk_sectors(s, ano, 1, "anode")) return NULL; if ((anode =3D hpfs_map_sector(s, ano, bhp, ANODE_RD_AHEAD))) - if (hpfs_sb(s)->sb_chk) { + { if (le32_to_cpu(anode->magic) !=3D ANODE_MAGIC) { hpfs_error(s, "bad magic on anode %08x", ano); goto bail; @@ -257,7 +257,7 @@ struct dnode *hpfs_map_dnode(struct super_block *s, uns= igned secno, struct quad_buffer_head *qbh) { struct dnode *dnode; - if (hpfs_sb(s)->sb_chk) { + { if (hpfs_chk_sectors(s, secno, 4, "dnode")) return NULL; if (secno & 3) { hpfs_error(s, "dnode %08x not byte-aligned", secno); @@ -265,7 +265,7 @@ struct dnode *hpfs_map_dnode(struct super_block *s, uns= igned secno, }=09 } if ((dnode =3D hpfs_map_4sectors(s, secno, qbh, DNODE_RD_AHEAD))) - if (hpfs_sb(s)->sb_chk) { + { unsigned p, pp =3D 0; unsigned char *d =3D (unsigned char *)dnode; int b =3D 0; diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index c16d5d4caead..a84725601445 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c @@ -349,8 +349,7 @@ HPFS filesystem options:\n\ umask=3Dxxx set mode of files that don't have mode specified= in eas\n\ case=3Dlower lowercase all files\n\ case=3Dasis do not lowercase files (default)\n\ - check=3Dnone no fs checks - kernel may crash on corrupted fil= esystem\n\ - check=3Dnormal do some checks - it should not crash (default)\n\ + check=3Dnormal do some checks - kernel should not crash (defaul= t)\n\ check=3Dstrict do extra time-consuming checks, used for debuggi= ng\n\ errors=3Dcontinue continue on errors\n\ errors=3Dremount-ro remount read-only if errors found (default)\n\ @@ -615,7 +614,9 @@ static int hpfs_fill_super(struct super_block *s, struc= t fs_context *fc) if (sbi->sb_err =3D=3D 0) pr_err("Proceeding, but your filesystem could be corrupted if you delet= e files or directories\n"); } - if (sbi->sb_chk) { + if (!ctx->chk) + pr_info_once("check=3Dnone was obsoleted. Treating as check=3Dnormal.\n"= ); + { unsigned a; if (le32_to_cpu(superblock->dir_band_end) - le32_to_cpu(superblock->dir_= band_start) + 1 !=3D le32_to_cpu(superblock->n_dir_band) || le32_to_cpu(superblock->dir_band_end) < le32_to_cpu(superblock->dir_= band_start) || le32_to_cpu(superblock->n_dir_band) > 0x4000) { @@ -632,8 +633,7 @@ static int hpfs_fill_super(struct super_block *s, struc= t fs_context *fc) goto bail4; } sbi->sb_dirband_size =3D a; - } else - pr_err("You really don't want any checks? You are crazy...\n"); + } =20 /* Load code page table */ if (le32_to_cpu(spareblock->n_code_pages)) --=20 2.47.3