]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ext4: fix bs < ps issue reported with dioread_nolock mount opt
authorRitesh Harjani <riteshh@linux.ibm.com>
Thu, 8 Oct 2020 15:02:48 +0000 (20:32 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:51:52 +0000 (11:51 +0100)
commit d1e18b8824dd50cff255e6cecf515ea598eaf9f0 upstream.

left shifting m_lblk by blkbits was causing value overflow and hence
it was not able to convert unwritten to written extent.
So, make sure we typecast it to loff_t before do left shift operation.
Also in func ext4_convert_unwritten_io_end_vec(), make sure to initialize
ret variable to avoid accidentally returning an uninitialized ret.

This patch fixes the issue reported in ext4 for bs < ps with
dioread_nolock mount option.

Fixes: c8cc88163f40df39e50c ("ext4: Add support for blocksize < pagesize in dioread_nolock")
Cc: stable@kernel.org
Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/af902b5db99e8b73980c795d84ad7bb417487e76.1602168865.git.riteshh@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/extents.c
fs/ext4/inode.c

index 0a5205edc00a8f2b14bb22ac74c38f7556d63596..3998c11f9517187eb7d094b611afac858736c1d5 100644 (file)
@@ -4770,7 +4770,7 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode,
 
 int ext4_convert_unwritten_io_end_vec(handle_t *handle, ext4_io_end_t *io_end)
 {
-       int ret, err = 0;
+       int ret = 0, err = 0;
        struct ext4_io_end_vec *io_end_vec;
 
        /*
index 288704e9064b355a5c4f57eae08cfe724602ed18..16a8c29256cd99482755c9c7f9c58c79c115c9f5 100644 (file)
@@ -2257,7 +2257,7 @@ static int mpage_process_page(struct mpage_da_data *mpd, struct page *page,
                                        err = PTR_ERR(io_end_vec);
                                        goto out;
                                }
-                               io_end_vec->offset = mpd->map.m_lblk << blkbits;
+                               io_end_vec->offset = (loff_t)mpd->map.m_lblk << blkbits;
                        }
                        *map_bh = true;
                        goto out;