[Devel] [PATCH RHEL7 COMMIT] ms/ext4: fix error handling in ext4_ext_shift_extents

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 16 13:59:00 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.10.1.vz7.162.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.10.1.vz7.162.3
------>
commit 54edf7f37e6564470911fc15af67f9e6a5090f35
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Sun Apr 13 15:05:42 2014 -0400

    ms/ext4: fix error handling in ext4_ext_shift_extents
    
    Fix error handling by adding some.  :-)
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
    Signed-off-by: "Theodore Ts'o" <tytso at mit.edu>
    
    https://jira.sw.ru/browse/PSBM-104562
    
    (cherry picked from commit 8dc79ec4c0537e1b83c0739af82a7babefb30012)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/ext4/extents.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 78dd03a0453c4..0a636ff128982 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5416,11 +5416,18 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
 	 * enough to accomodate the shift.
 	 */
 	path = ext4_ext_find_extent(inode, start - 1, NULL, 0);
+	if (IS_ERR(path))
+		return PTR_ERR(path);
 	depth = path->p_depth;
 	extent =  path[depth].p_ext;
-	ex_start = le32_to_cpu(extent->ee_block);
-	ex_end = le32_to_cpu(extent->ee_block) +
+	if (extent) {
+		ex_start = le32_to_cpu(extent->ee_block);
+		ex_end = le32_to_cpu(extent->ee_block) +
 			ext4_ext_get_actual_len(extent);
+	} else {
+		ex_start = 0;
+		ex_end = 0;
+	}
 	ext4_ext_drop_refs(path);
 	kfree(path);
 


More information about the Devel mailing list