android_kernel_google_msm/fs/sysfs
Ming Lei 6615e6db12 sysfs: fix use after free in case of concurrent read/write and readdir
commit f7db5e7660 upstream.

The inode->i_mutex isn't hold when updating filp->f_pos
in read()/write(), so the filp->f_pos might be read as
0 or 1 in readdir() when there is concurrent read()/write()
on this same file, then may cause use after free in readdir().

The bug can be reproduced with Li Zefan's test code on the
link:

	https://patchwork.kernel.org/patch/2160771/

This patch fixes the use after free under this situation.

Reported-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-07 19:51:54 -07:00
..
bin.c
dir.c sysfs: fix use after free in case of concurrent read/write and readdir 2013-05-07 19:51:54 -07:00
file.c
group.c sysfs: Prevent crash on unset sysfs group attributes 2012-04-10 14:48:51 -07:00
inode.c Revert "sysfs: Kill nlink counting." 2012-03-08 13:03:10 -08:00
Kconfig
Makefile
mount.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-03-21 13:36:41 -07:00
symlink.c
sysfs.h Revert "sysfs: Kill nlink counting." 2012-03-08 13:03:10 -08:00