From: Andreas Gruenbacher Date: Thu, 17 Mar 2022 13:47:24 +0000 (+0100) Subject: gfs2: Fix gfs2_file_buffered_write endless loop workaround X-Git-Tag: v5.16.19~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a5e6d01a6e9e2c9ce86ce540ee5ea22fa5c8304;p=thirdparty%2Fkernel%2Fstable.git gfs2: Fix gfs2_file_buffered_write endless loop workaround commit 46f3e0421ccb5474b5c006b0089b9dfd42534bb6 upstream. Since commit 554c577cee95b, gfs2_file_buffered_write() can accidentally return a truncated iov_iter, which might confuse callers. Fix that. Fixes: 554c577cee95b ("gfs2: Prevent endless loops in gfs2_file_buffered_write") Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 5bac4f6e8e057..b53ad18e5ccbf 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -1083,6 +1083,7 @@ out_uninit: gfs2_holder_uninit(gh); if (statfs_gh) kfree(statfs_gh); + from->count = orig_count - read; return read ? read : ret; }