[Devel] [PATCH 2/2] fs/fuse kio: fix inode leak in pcs_fuse_submit()

Pavel Butsykin pbutsykin at virtuozzo.com
Fri May 31 16:44:55 MSK 2019


In the case when already prepared request will be rejected due to
FUSE_S_FAIL_IMMEDIATELY state in pcs_fuse_submit(), we will have inode
leak that is referenced in pcs_fuse_prep_rw().

Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index d97854ade4e8..0d8cb3a751e2 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -981,6 +981,9 @@ static int pcs_fuse_prep_rw(struct pcs_fuse_req *r, struct fuse_file *ff)
 	default:
 		BUG();
 	}
+
+	if (!kqueue_insert(di, ff, req))
+		return -EIO;
 	inode_dio_begin(req->io_inode);
 	return 0;
 fail:
@@ -1087,10 +1090,6 @@ error:
 	return;
 
 submit:
-	if (!kqueue_insert(di, ff, req)) {
-		req->out.h.error = -EIO;
-		goto error;
-	}
 	ireq_process(ireq);
 }
 
-- 
2.15.1



More information about the Devel mailing list