[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio_pcs: fix NULL pointer dereference in pcs_mapping_truncate()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 29 11:51:59 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.14
------>
commit dfeff3324b9507fb13c4857fa4b8ab4e04efc883
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Mon Oct 29 11:51:56 2018 +0300

    fs/fuse kio_pcs: fix NULL pointer dereference in pcs_mapping_truncate()
    
    Looks like a logical mistake.
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 4b5462aafe92..25c0281d5278 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2494,11 +2494,12 @@ noinline void pcs_mapping_truncate(struct pcs_int_request *ireq, u64 old_size)
 
 	if (m == NULL)
 		queue = 1;
-
-	spin_lock(&m->lock);
-	if (valid_for_truncate(m, ireq))
-		queue = 1;
-	spin_unlock(&m->lock);
+	else {
+		spin_lock(&m->lock);
+		if (valid_for_truncate(m, ireq))
+			queue = 1;
+		spin_unlock(&m->lock);
+	}
 
 	if (queue) {
 		if (m) {



More information about the Devel mailing list