]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gadgetfs: use-after-free in ->aio_read()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 6 Feb 2015 07:07:45 +0000 (02:07 -0500)
committerZefan Li <lizefan@huawei.com>
Fri, 19 Jun 2015 03:40:22 +0000 (11:40 +0800)
commit0b4b4c305e98a1feb94f4b0d2909f9e338ac0941
treea94efdeb323194e140e1dc73ec7eef7075d77299
parent464e503591a5172ff7a70d58b00c2ba2c2498c06
gadgetfs: use-after-free in ->aio_read()

commit f01d35a15fa04162a58b95970fc01fa70ec9dacd upstream.

AIO_PREAD requests call ->aio_read() with iovec on caller's stack, so if
we are going to access it asynchronously, we'd better get ourselves
a copy - the one on kernel stack of aio_run_iocb() won't be there
anymore.  function/f_fs.c take care of doing that, legacy/inode.c
doesn't...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[lizf: Backproted to 3.4:
 - adjust context
 - need kfree() after calling get_ready_ep()]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/usb/gadget/inode.c