backends/cryptodev-vhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
From c808fa797942b9bd32221594b7eef690a7558b14 Mon Sep 17 00:00:00 2001
From: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
Date: Mon, 23 Dec 2024 14:58:12 -0600
Subject: [PATCH] backends/cryptodev-vhost-user: Fix local_error leaks
Do not propagate error to the upper, directly output the error to
avoid leaks.
Closes: #2714
Signed-off-by: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
---
backends/cryptodev-vhost-user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 43efdf9747..09bfbddb47 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -281,8 +281,8 @@ static int cryptodev_vhost_user_create_session(
break;
default:
- error_setg(&local_error, "Unsupported opcode :%" PRIu32 "",
- sess_info->op_code);
+ error_report("Unsupported opcode :%" PRIu32 "",
+ sess_info->op_code);
return -VIRTIO_CRYPTO_NOTSUPP;
}
--
2.43.0
LGTM, thanks.
Reviewed-by: zhenwei pi <pizhenwei@bytedance.com>
On 12/24/24 07:46, Gabriel Barrantes wrote:
> From c808fa797942b9bd32221594b7eef690a7558b14 Mon Sep 17 00:00:00 2001
> From: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
> Date: Mon, 23 Dec 2024 14:58:12 -0600
> Subject: [PATCH] backends/cryptodev-vhost-user: Fix local_error leaks
>
> Do not propagate error to the upper, directly output the error to
> avoid leaks.
>
> Closes: #2714
>
> Signed-off-by: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
> ---
> backends/cryptodev-vhost-user.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-
> user.c
> index 43efdf9747..09bfbddb47 100644
> --- a/backends/cryptodev-vhost-user.c
> +++ b/backends/cryptodev-vhost-user.c
> @@ -281,8 +281,8 @@ static int cryptodev_vhost_user_create_session(
> break;
>
> default:
> - error_setg(&local_error, "Unsupported opcode :%" PRIu32 "",
> - sess_info->op_code);
> + error_report("Unsupported opcode :%" PRIu32 "",
> + sess_info->op_code);
> return -VIRTIO_CRYPTO_NOTSUPP;
> }
>
> --
> 2.43.0
>
>
Hi Gabriel,
On 24/12/24 00:46, Gabriel Barrantes wrote:
> From c808fa797942b9bd32221594b7eef690a7558b14 Mon Sep 17 00:00:00 2001
> From: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
> Date: Mon, 23 Dec 2024 14:58:12 -0600
> Subject: [PATCH] backends/cryptodev-vhost-user: Fix local_error leaks
>
> Do not propagate error to the upper, directly output the error to
> avoid leaks.
>
> Closes: #2714
Better to use the full issue url to ease downstream backports
where this commit is cherry-picked:
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2714
Fixes: 2fda101de07 ("virtio-crypto: Support asynchronous mode")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Signed-off-by: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
> ---
> backends/cryptodev-vhost-user.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-
> user.c
> index 43efdf9747..09bfbddb47 100644
> --- a/backends/cryptodev-vhost-user.c
> +++ b/backends/cryptodev-vhost-user.c
> @@ -281,8 +281,8 @@ static int cryptodev_vhost_user_create_session(
> break;
>
> default:
> - error_setg(&local_error, "Unsupported opcode :%" PRIu32 "",
> - sess_info->op_code);
> + error_report("Unsupported opcode :%" PRIu32 "",
> + sess_info->op_code);
> return -VIRTIO_CRYPTO_NOTSUPP;
> }
Arei, Pi, Having CryptoDevBackendClass::create_session() take an errp
argument would simplify the call chain, reporting the error once in
cryptodev_backend_create_session().
>
> --
> 2.43.0
>
>
On 12/24/24 16:59, Philippe Mathieu-Daudé wrote:
> Hi Gabriel,
>
> On 24/12/24 00:46, Gabriel Barrantes wrote:
>> From c808fa797942b9bd32221594b7eef690a7558b14 Mon Sep 17 00:00:00 2001
>> From: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
>> Date: Mon, 23 Dec 2024 14:58:12 -0600
>> Subject: [PATCH] backends/cryptodev-vhost-user: Fix local_error leaks
>>
>> Do not propagate error to the upper, directly output the error to
>> avoid leaks.
>>
>> Closes: #2714
>
> Better to use the full issue url to ease downstream backports
> where this commit is cherry-picked:
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2714
>
> Fixes: 2fda101de07 ("virtio-crypto: Support asynchronous mode")
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
>>
>> Signed-off-by: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
>> ---
>> backends/cryptodev-vhost-user.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-
>> vhost- user.c
>> index 43efdf9747..09bfbddb47 100644
>> --- a/backends/cryptodev-vhost-user.c
>> +++ b/backends/cryptodev-vhost-user.c
>> @@ -281,8 +281,8 @@ static int cryptodev_vhost_user_create_session(
>> break;
>>
>> default:
>> - error_setg(&local_error, "Unsupported opcode :%" PRIu32 "",
>> - sess_info->op_code);
>> + error_report("Unsupported opcode :%" PRIu32 "",
>> + sess_info->op_code);
>> return -VIRTIO_CRYPTO_NOTSUPP;
>> }
>
> Arei, Pi, Having CryptoDevBackendClass::create_session() take an errp
> argument would simplify the call chain, reporting the error once in
> cryptodev_backend_create_session().
>
Good idea, I'll do it later.
>>
>> --
>> 2.43.0
>>
>>
>
© 2016 - 2026 Red Hat, Inc.