[Devel] [PATCH RHEL COMMIT] ve/printk: fix error handling in ve_log_init

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 4 16:21:04 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 75526cfd5eb9e5ca4ccebeea53ebc6b866e745f8
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Mon Oct 4 13:10:21 2021 +0300

    ve/printk: fix error handling in ve_log_init
    
    On succesful setup_log_buf_ve we should not free log and return 0,
    that's wrong. This leads to zero log_state on succesful ve start and
    leads to crash in ve_log_destroy.
    
    https://jira.sw.ru/browse/PSBM-134393
    Fixes: 40428a8d4e0b ("ve/printk: Introduce struct "log_state" and virtualize log_buf/log_buf_len")
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 kernel/printk/printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 47ec962371ae..ff8a41260284 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3741,7 +3741,7 @@ int ve_log_init(struct ve_struct *ve)
 		return -ENOMEM;
 
 	ret = setup_log_buf_ve(log, ve, 0);
-	if (!ret) {
+	if (ret) {
 		kfree(log);
 		return ret;
 	}


More information about the Devel mailing list