ceph: do not access the kiocb after aio requests
authorXiubo Li <xiubli@redhat.com>
Mon, 6 Jul 2020 12:51:35 +0000 (08:51 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:22 +0000 (11:29 +0200)
commit3bd5dad493e53ef1574e7c4fcecd787a95fa7aba
tree17fdd7bc1953fe6c3578c5eded404a4995a22272
parente9c34e71a043ff59a05ac626c475539beb0ee3be
ceph: do not access the kiocb after aio requests

[ Upstream commit d1d9655052606fd9078e896668ec90191372d513 ]

In aio case, if the completion comes very fast just before the
ceph_read_iter() returns to fs/aio.c, the kiocb will be freed in
the completion callback, then if ceph_read_iter() access again
we will potentially hit the use-after-free bug.

[ jlayton: initialize direct_lock early, and use it everywhere ]

URL: https://tracker.ceph.com/issues/45649
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/file.c