[Devel] [PATCH RHEL7 COMMIT] pfcache: Fix unitialized s_csum_partial

Vasily Averin vvs at virtuozzo.com
Fri Nov 26 11:06:48 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.42.2.vz7.184.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.42.2.vz7.184.5
------>
commit 6dc84e083c94451023f94c0ce2605d141d64ba39
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Nov 26 11:06:44 2021 +0300

    pfcache: Fix unitialized s_csum_partial
    
    Since percpu_counter::counters is not allocated,
    add and sub operations write to percpu memory
    with 0 offset.
    
    In scope of https://jira.sw.ru/browse/PSBM-134639
    Fixes: 1204e364ca05 "pfcache: add hashed peers for ext4"
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/ext4/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8105567..2d7c1d7 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4540,7 +4540,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	sbi->s_err_report.data = (unsigned long) sb;
 
 	err = percpu_counter_init(&sbi->s_extent_cache_cnt, 0, GFP_KERNEL);
-	if (err)
+	if (!err)
 		err = percpu_counter_init(&sbi->s_csum_partial, 0, GFP_KERNEL);
 	if (!err)
 		err = percpu_counter_init(&sbi->s_csum_complete, 0, GFP_KERNEL);


More information about the Devel mailing list