freebsd-dev/sys/fs/msdosfs
Bruce Evans c2819440b3 Fix races in msdosfs_lookup() and msdosfs_readdir(). These functions
can easily block in bread(), and then there was nothing to prevent the
static buffer (nambuf_{ptr,len,last_id}) being clobbered by another
thread.

The effects of the bug seem to have been limited to failed lookups and
mangled names in readdir(), since Giant locking provides enough
serialization to prevent concurrent calls to the functions that access
the buffer.  They were very obvious for multiple concurrent tree walks,
especially with a small cluster size.

The bug was introduced in msdosfs_conv.c 1.34 and associated changes,
and is in all releases starting with 5.2.

The fix is to allocate the buffer as a local variable and pass around
pointers to it like "_r" functions in libc do.  Stack use from this
is large but not too large.  This also fixes a memory leak on module
unload.

Reviewed by:	kib
Approved by:	re (kensmith)
2007-08-31 22:29:55 +00:00
..
bootsect.h Remove checks for BOOTSIG[23] from FAT32 bootblocks. 2005-09-29 14:09:46 +00:00
bpb.h Fix some bugs involving the fsinfo block (many remain unfixed). This is 2007-07-12 16:09:07 +00:00
denode.h Fix some style bugs (some whitespace errors only). 2007-08-07 03:22:10 +00:00
direntry.h Fix races in msdosfs_lookup() and msdosfs_readdir(). These functions 2007-08-31 22:29:55 +00:00
fat.h /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 18:10:42 +00:00
msdosfs_conv.c Fix races in msdosfs_lookup() and msdosfs_readdir(). These functions 2007-08-31 22:29:55 +00:00
msdosfs_denode.c Fix some style bugs (don't assume that off_t == int64_t; fix some comments; 2007-08-07 03:59:49 +00:00
msdosfs_fat.c Fix some style bugs (some whitespace errors only). 2007-08-07 03:22:10 +00:00
msdosfs_fileno.c Remove unused include(s). 2007-08-07 02:08:06 +00:00
msdosfs_iconv.c Remove unused include(s). 2007-08-07 02:08:06 +00:00
msdosfs_lookup.c Fix races in msdosfs_lookup() and msdosfs_readdir(). These functions 2007-08-31 22:29:55 +00:00
msdosfs_vfsops.c On 6.x this works: 2007-08-15 17:40:09 +00:00
msdosfs_vnops.c Fix races in msdosfs_lookup() and msdosfs_readdir(). These functions 2007-08-31 22:29:55 +00:00
msdosfsmount.h Fix some bugs involving the fsinfo block (many remain unfixed). This is 2007-07-12 16:09:07 +00:00