Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1638392
| From | Tigran Aivazian <tigran@aivazian.fsnet.co.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] bfs: Fix sanity checks for empty files |
| Date | 2017-05-09 22:30 +0200 |
| Message-ID | <tFjVE-6MU-17@gated-at.bofh.it> (permalink) |
| References | <tDRRL-6Av-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
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.
Kind regards,
Tigran
On 5 May 2017 at 21:16, Rakesh Pandit <rakesh@tuxera.com> wrote:
> 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
>
> Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
> ---
>
> This was sent three years but maintainer has been unresponsive:
> https://marc.info/?l=linux-kernel&m=138980764525250
>
> So sending you Andrew as previous patches to bfs have gone through
> your tree. This is tested and reproducible.
>
> fs/bfs/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> index f2deec0..0d3dc18 100644
> --- a/fs/bfs/inode.c
> +++ b/fs/bfs/inode.c
> @@ -419,7 +419,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
> 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);
> --
> 2.9.3
>
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] bfs: Fix sanity checks for empty files Rakesh Pandit <rakesh@tuxera.com> - 2017-05-05 22:20 +0200 Re: [PATCH] bfs: Fix sanity checks for empty files Tigran Aivazian <tigran@aivazian.fsnet.co.uk> - 2017-05-09 22:30 +0200
csiph-web