kernel-ark/fs/isofs
Kirill Kuvaldin 817794e0df isofs: mounting to regular file may succeed
It turned out that mounting a corrupted ISO image to a regular file may
succeed, e.g.  if an image was prepared as follows:

$ dd if=correct.iso of=bad.iso bs=4k count=8

We then can mount it to a regular file:

# mount -o loop -t iso9660 bad.iso /tmp/file

But mounting it to a directory fails with -ENOTDIR, simply because
the root directory inode doesn't have S_IFDIR set and the condition
in graft_tree() is met:

	if (S_ISDIR(nd->dentry->d_inode->i_mode) !=
	      S_ISDIR(mnt->mnt_root->d_inode->i_mode))
		return -ENOTDIR

This is because the root directory inode was read from an incorrect
block. It's supposed to be read from sbi->s_firstdatazone, which is
an absolute value and gets messed up in the case of an incorrect image.

In order to somehow circumvent this we have to check that the root
directory inode is actually a directory after all.

Signed-off-by: Kirill Kuvaldin <kuvkir@epsmu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-31 15:39:41 -07:00
..
compress.c [PATCH] isofs: change uses of f_{dentry, vfsmnt} to use f_path 2006-12-08 08:28:41 -08:00
dir.c isofs: fix up CodingStyle 2007-07-16 09:05:42 -07:00
export.c
inode.c isofs: mounting to regular file may succeed 2007-07-31 15:39:41 -07:00
isofs.h knfsd: exportfs: add exportfs.h header 2007-07-17 10:23:06 -07:00
joliet.c isofs: fix up CodingStyle 2007-07-16 09:05:42 -07:00
Makefile
namei.c isofs: fix up CodingStyle 2007-07-16 09:05:42 -07:00
rock.c [PATCH] mark address_space_operations const 2006-06-28 14:59:04 -07:00
rock.h
util.c
zisofs.h [PATCH] mark address_space_operations const 2006-06-28 14:59:04 -07:00