linux/fs/fat
Jan Engelhardt 19c561a60f fs/fat/: refine chmod checks
Prohibit mode changes in non-quiet mode that cannot be stored reliably with
the on-disk format.

Suppose a vfat filesystem is mounted with umask=0 and [not-quiet].  Then
all files will have mode 0777.  Trying to change the owner will fail,
because fat does not know about owners or groups.  chmod 0770, on the other
hand, will succeed, even though fat does not know about the permission
triplet [user/group/other].

So this patch changes fat's not-quiet behavior so that only UNIX modes are
accepted that can be mapped lossless between the fat disk format and the
local system.  There is only one attribute, and that is the readonly
attribute, which is mapped to the UNIX write permission bit(s).  chmod 0555
is therefore valid (taking away the +w bits <=> setting the readonly
attribute).  Since chmod 0775 and chmod 0755 is an ambiguous case as to
whether to set or clear the readonly bit, these modes are also denied.

In quiet mode, chmod and chown will continue to "succeed" as they did
before, meaning that a subsequent stat() will temporarily return the new
mode as long as the inode is not reread from disk, and chown will silently
do nothing, not even return the new uid/gid in stat().

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-06 10:40:59 -08:00
..
cache.c Slab API: remove useless ctor parameter and reorder parameters 2007-10-17 08:42:45 -07:00
dir.c fat: gcc 4.3 warning fix 2007-07-16 09:05:42 -07:00
fatent.c fat: optimize fat_count_free_clusters() 2008-01-08 16:10:35 -08:00
file.c fs/fat/: refine chmod checks 2008-02-06 10:40:59 -08:00
inode.c exportfs: make struct export_operations const 2007-10-22 08:13:21 -07:00
Makefile
misc.c [PATCH] fs/fat/misc.c: unexport fat_sync_bhs 2006-06-23 07:43:03 -07:00