]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fuse: do not use iocb after it may have been freed
authorRobert Doebbelin <robert@quobyte.com>
Mon, 7 Mar 2016 08:50:56 +0000 (09:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 14:33:39 +0000 (07:33 -0700)
commitf5b07883c0c3b68c9f04f1d573949c9621ab3395
tree8e4524cc1e9589eddc4e7836c35a3864fe1fa7cb
parentbdb486fac4c1cc167fe9017e3fd3bc5b88090d6e
fuse: do not use iocb after it may have been freed

commit 7cabc61e01a0a8b663bd2b4c982aa53048218734 upstream.

There's a race in fuse_direct_IO(), whereby is_sync_kiocb() is called on an
iocb that could have been freed if async io has already completed.  The fix
in this case is simple and obvious: cache the result before starting io.

It was discovered by KASan:

kernel: ==================================================================
kernel: BUG: KASan: use after free in fuse_direct_IO+0xb1a/0xcc0 at addr ffff88036c414390

Signed-off-by: Robert Doebbelin <robert@quobyte.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: bcba24ccdc82 ("fuse: enable asynchronous processing direct IO")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/fuse/file.c