diff options
author | Ming Lei <ming.lei@canonical.com> | 2013-04-02 10:12:26 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2013-05-13 15:02:13 +0100 |
commit | 3a8aad02f417b5aecafdc785c39c0e2259995c69 (patch) | |
tree | 956423616bd281c99edbb37912c283cca1d3832f /fs/binfmt_script.c | |
parent | 893bee37f931a600f473801ee1c9c3e2030c2c86 (diff) |
sysfs: fix use after free in case of concurrent read/write and readdir
commit f7db5e7660b122142410dcf36ba903c73d473250 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>
[bwh: Backported to 3.2: file position is child inode number, not hash]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs/binfmt_script.c')
0 files changed, 0 insertions, 0 deletions