* + bfs-fix-sanity-checks-for-empty-files.patch added to -mm tree
@ 2017-05-09 21:00 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2017-05-09 21:00 UTC (permalink / raw)
To: rakesh, tigran, mm-commits
The patch titled
Subject: bfs: fix sanity checks for empty files
has been added to the -mm tree. Its filename is
bfs-fix-sanity-checks-for-empty-files.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/bfs-fix-sanity-checks-for-empty-files.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/bfs-fix-sanity-checks-for-empty-files.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Rakesh Pandit <rakesh@tuxera.com>
Subject: bfs: fix sanity checks for empty files
Mount fails if file system image has empty files because of sanity check
while reading superblock. For empty files disk offset to end of file
(i_eoffset) is cpu_to_le32(-1). Sanity check comparison, which compares
disk offset with file system size isn't valid for this value and hence is
ignored with this patch.
Steps to reproduce:
$ dd if=/dev/zero of=bfs-image count=204800
$ mkfs.bfs bfs-image
$ mkdir bfs-mount-point
$ sudo mount -t bfs -o loop bfs-image bfs-mount-point/
$ cd bfs-mount-point/
$ sudo touch a
$ cd ..
$ sudo umount bfs-mount-point/
$ sudo mount -t bfs -o loop bfs-image bfs-mount-point/
mount: /dev/loop0: can't read superblock
$ dmesg
[25526.689580] BFS-fs: bfs_fill_super(): Inode 0x00000003 corrupted
Tigran said:
: If you had created the filesystem with the proper mkfs under SCO UnixWare
: 7 you (probably) wouldn't encounter this issue. But since commercial
: Unix-es are now part of history and the only proper way is the Linux
: mkfs.bfs utility, your patch is fine.
Link: http://lkml.kernel.org/r/20170505201625.GA3097@hercules.tuxera.com
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/bfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN fs/bfs/inode.c~bfs-fix-sanity-checks-for-empty-files fs/bfs/inode.c
--- a/fs/bfs/inode.c~bfs-fix-sanity-checks-for-empty-files
+++ a/fs/bfs/inode.c
@@ -419,7 +419,7 @@ static int bfs_fill_super(struct super_b
if (i_sblock > info->si_blocks ||
i_eblock > info->si_blocks ||
i_sblock > i_eblock ||
- i_eoff > s_size ||
+ (i_eoff != le32_to_cpu(-1) && i_eoff > s_size) ||
i_sblock * BFS_BSIZE > i_eoff) {
printf("Inode 0x%08x corrupted\n", i);
_
Patches currently in -mm which might be from rakesh@tuxera.com are
bfs-fix-sanity-checks-for-empty-files.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-05-09 21:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 21:00 + bfs-fix-sanity-checks-for-empty-files.patch added to -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).