Files
linux/fs/sysfs
Ming Lei dda34083d8 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 20:08:20 -07:00
..
2012-11-26 16:25:36 -08:00
2005-04-16 15:20:36 -07:00