]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Fix BeFS slab corruption
authorDiego Calleja <diegocg@gmail.com>
Sat, 5 Aug 2006 19:14:55 +0000 (12:14 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Aug 2006 21:13:30 +0000 (14:13 -0700)
commit2fc58b11d73cc8baafa61b70e4c749d466f92b2a
tree1d5f0d42b0d9ca4d35efb0c6a9f80ef7a006cbdb
parent216cf62f1fd2fba890d43956a8548eb10382b658
Fix BeFS slab corruption

In bugzilla #6941, Jens Kilian reported:

"The function befs_utf2nls (in fs/befs/linuxvfs.c) writes a 0 byte past the
end of a block of memory allocated via kmalloc(), leading to memory
corruption.  This happens only for filenames which are pure ASCII and a
multiple of 4 bytes in length.  [...]

Without DEBUG_SLAB, this leads to further corruption and hard lockups; I
believe this is the bug which has made kernels later than 2.6.8 unusable
for me.  (This must be due to changes in memory management, the bug has
been in the BeFS driver since the time it was introduced (AFAICT).)

Steps to reproduce:
Create a directory (in BeOS, naturally :-) with files named, e.g.,
"1", "22", "333", "4444", ...  Mount it in Linux and do an "ls" or "find""

This patch implements the suggested fix. Credits to Jens Kilian for
debugging the problem and finding the right fix.

Signed-off-by: Diego Calleja <diegocg@gmail.com>
Cc: Jens Kilian <jjk@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/befs/linuxvfs.c