[Devel] [PATCH RHEL7 COMMIT] fuse kio: Move map_chunk_start() and map_chunk_end() checks

Konstantin Khorenko khorenko at virtuozzo.com
Tue Aug 14 19:39:52 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.9.1.vz7.70.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.9.1.vz7.70.5
------>
commit 4108ce316f35628ae54adccf3d0ea7279c610f01
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Aug 14 19:39:52 2018 +0300

    fuse kio: Move map_chunk_start() and map_chunk_end() checks
    
    The both functions are valid in case of map is not dead.
    Otherwise, they dereference zero m->mapping pointer.
    Fix that.
    
    Fixes: 66e16d47b6f4 ("fuse kio: Add pcs engine combo v0.8")
    
    https://jira.sw.ru/browse/PSBM-87665
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index f5b74b202105..ebba23546c94 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -893,8 +893,6 @@ int pcs_map_encode_req(struct pcs_map_entry*m, struct pcs_ioc_getmap *map, int d
 	int i;
 
 	spin_lock(&m->lock);
-	BUG_ON(map_chunk_start(m) > m->res_offset);
-	BUG_ON(map_chunk_end(m) < m->res_offset);
 	/*
 	 * Someone truncate mapping while IO is in progress
 	 * aio_dio vs truncate race ?
@@ -904,6 +902,8 @@ int pcs_map_encode_req(struct pcs_map_entry*m, struct pcs_ioc_getmap *map, int d
 		pcs_map_put(m);
 		return 1;
 	}
+	BUG_ON(map_chunk_start(m) > m->res_offset);
+	BUG_ON(map_chunk_end(m) < m->res_offset);
 
 	map->uid = m->id;
 	map->version = m->version;


More information about the Devel mailing list