FAILED: patch "[PATCH] fuse: fix use-after-free in fuse_direct_IO()" failed to apply to 4.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
ebacb81273599555a7a19f7754a1451206a5fc4fMon Sep 17 00:00:00 2001
From: Lukas Czerner <[email protected]>
Date: Fri, 9 Nov 2018 14:51:46 +0100
Subject: [PATCH] fuse: fix use-after-free in fuse_direct_IO()
In async IO blocking case the additional reference to the io is taken for it to survive fuse_aio_complete(). In non blocking case this additional reference is not needed, however we still reference io to figure out whether to wait for completion or not. This is wrong and will lead to use-after-free. Fix it by storing blocking information in separate variable.
This was spotted by KASAN when running generic/208 fstest.
fs/fuse/file.c +3 -1
@@ -2924,10 +2924,12 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) }if (io->async) { +bool blocking = io->blocking; +fuse_aio_complete (io, ret <0 ? ret :0 ,-1 );/* we have a non-extending, async request, so return */ -if (!io->blocking) +if (!blocking)return -EIOCBQUEUED ;wait_for_completion (&wait);