[Devel] [PATCH 2/2] fs/fuse kio: fix length overflow in FALLOC_FL_KEEP_SIZE

Pavel Butsykin pbutsykin at virtuozzo.com
Wed Jun 5 18:50:22 MSK 2019


#VSTOR-23781

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

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 60c47aaf592e..bdaca666f6e9 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -1049,6 +1049,8 @@ static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, struct fuse_req *req,
 		}
 
 		if (inarg->mode & FALLOC_FL_KEEP_SIZE) {
+			if (inarg->offset > di->fileinfo.attr.size)
+				break; /* NOPE */
 			if (inarg->offset + inarg->length > di->fileinfo.attr.size)
 				inarg->length = di->fileinfo.attr.size - inarg->offset;
 		}
-- 
2.15.1



More information about the Devel mailing list