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

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 31 19:10:43 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.10
------>
commit 2317eb521bf6f585ad18075dd471383823fcd36a
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Fri May 31 19:10:41 2019 +0300

    fs/fuse kio: fix inode leak in pcs_fuse_submit()
    
    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 50c39c0ab8e7..8467ddb5707d 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 @@ static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, struct fuse_req *req,
 	return;
 
 submit:
-	if (!kqueue_insert(di, ff, req)) {
-		req->out.h.error = -EIO;
-		goto error;
-	}
 	ireq_process(ireq);
 }
 



More information about the Devel mailing list