[Devel] [PATCH RH9] ve/printk: fix error handling in ve_log_init
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Mon Oct 4 13:17:54 MSK 2021
On 04.10.2021 13:15, Pavel Tikhomirov wrote:
> 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;
> }
>
--
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.
More information about the Devel
mailing list