]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gfs2: Fix gfs2_file_buffered_write endless loop workaround
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 17 Mar 2022 13:47:24 +0000 (14:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:06:49 +0000 (14:06 +0200)
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 <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/file.c

index 5bac4f6e8e057f551a26be8d6685488d29627c00..b53ad18e5ccbfac3a4d5a18d1035d7d10552f675 100644 (file)
@@ -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;
 }