ext4: initialize retries variable in ext4_da_write_inline_data_begin()
authorLukas Czerner <lczerner@redhat.com>
Wed, 3 Oct 2018 01:18:45 +0000 (21:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:15:06 +0000 (11:15 -0800)
commit 625ef8a3acd111d5f496d190baf99d1a815bd03e upstream.

Variable retries is not initialized in ext4_da_write_inline_data_begin()
which can lead to nondeterministic number of retries in case we hit
ENOSPC. Initialize retries to zero as we do everywhere else.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fixes: bc0ca9df3b2a ("ext4: retry allocation when inline->extent conversion failed")
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inline.c

index 4e1d62ba0703f96ddb5811bb993cf56e794c53fc..ac2e0516c16ff6445f67f0c9b28c668562702974 100644 (file)
@@ -869,7 +869,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
        handle_t *handle;
        struct page *page;
        struct ext4_iloc iloc;
-       int retries;
+       int retries = 0;
 
        ret = ext4_get_inode_loc(inode, &iloc);
        if (ret)