All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xl: properly dispose of vTPM struct instance
@ 2025-01-14  8:13 Jan Beulich
  2025-01-14  9:28 ` Andrew Cooper
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jan Beulich @ 2025-01-14  8:13 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org; +Cc: Anthony PERARD, Oleksii Kurochko

The backend_domname field requires separate freeing; make sure to call
libxl_device_vtpm_dispose() also on respective error paths.

Coverity-ID: 1638719
Fixes: dde22055ac3a ("libxl: add vtpm support")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/tools/xl/xl_vtpm.c
+++ b/tools/xl/xl_vtpm.c
@@ -44,12 +44,14 @@ int main_vtpmattach(int argc, char **arg
         if (MATCH_OPTION("uuid", *argv, oparg)) {
             if(libxl_uuid_from_string(&(vtpm.uuid), oparg)) {
                 fprintf(stderr, "Invalid uuid specified (%s)\n", oparg);
+                libxl_device_vtpm_dispose(&vtpm);
                 return 1;
             }
         } else if (MATCH_OPTION("backend", *argv, oparg)) {
             replace_string(&vtpm.backend_domname, oparg);
         } else {
             fprintf(stderr, "unrecognized argument `%s'\n", *argv);
+            libxl_device_vtpm_dispose(&vtpm);
             return 1;
         }
     }
@@ -65,6 +67,7 @@ int main_vtpmattach(int argc, char **arg
 
     if (libxl_device_vtpm_add(ctx, domid, &vtpm, 0)) {
         fprintf(stderr, "libxl_device_vtpm_add failed.\n");
+        libxl_device_vtpm_dispose(&vtpm);
         return 1;
     }
     libxl_device_vtpm_dispose(&vtpm);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xl: properly dispose of vTPM struct instance
  2025-01-14  8:13 [PATCH] xl: properly dispose of vTPM struct instance Jan Beulich
@ 2025-01-14  9:28 ` Andrew Cooper
  2025-01-14 11:25 ` Oleksii Kurochko
  2025-01-16 13:12 ` Anthony PERARD
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2025-01-14  9:28 UTC (permalink / raw)
  To: Jan Beulich, xen-devel@lists.xenproject.org
  Cc: Anthony PERARD, Oleksii Kurochko

On 14/01/2025 8:13 am, Jan Beulich wrote:
> The backend_domname field requires separate freeing; make sure to call
> libxl_device_vtpm_dispose() also on respective error paths.
>
> Coverity-ID: 1638719
> Fixes: dde22055ac3a ("libxl: add vtpm support")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xl: properly dispose of vTPM struct instance
  2025-01-14  8:13 [PATCH] xl: properly dispose of vTPM struct instance Jan Beulich
  2025-01-14  9:28 ` Andrew Cooper
@ 2025-01-14 11:25 ` Oleksii Kurochko
  2025-01-16 13:12 ` Anthony PERARD
  2 siblings, 0 replies; 4+ messages in thread
From: Oleksii Kurochko @ 2025-01-14 11:25 UTC (permalink / raw)
  To: Jan Beulich, xen-devel@lists.xenproject.org; +Cc: Anthony PERARD


On 1/14/25 9:13 AM, Jan Beulich wrote:
> The backend_domname field requires separate freeing; make sure to call
> libxl_device_vtpm_dispose() also on respective error paths.
>
> Coverity-ID: 1638719
> Fixes: dde22055ac3a ("libxl: add vtpm support")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

R-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii

>
> --- a/tools/xl/xl_vtpm.c
> +++ b/tools/xl/xl_vtpm.c
> @@ -44,12 +44,14 @@ int main_vtpmattach(int argc, char **arg
>           if (MATCH_OPTION("uuid", *argv, oparg)) {
>               if(libxl_uuid_from_string(&(vtpm.uuid), oparg)) {
>                   fprintf(stderr, "Invalid uuid specified (%s)\n", oparg);
> +                libxl_device_vtpm_dispose(&vtpm);
>                   return 1;
>               }
>           } else if (MATCH_OPTION("backend", *argv, oparg)) {
>               replace_string(&vtpm.backend_domname, oparg);
>           } else {
>               fprintf(stderr, "unrecognized argument `%s'\n", *argv);
> +            libxl_device_vtpm_dispose(&vtpm);
>               return 1;
>           }
>       }
> @@ -65,6 +67,7 @@ int main_vtpmattach(int argc, char **arg
>   
>       if (libxl_device_vtpm_add(ctx, domid, &vtpm, 0)) {
>           fprintf(stderr, "libxl_device_vtpm_add failed.\n");
> +        libxl_device_vtpm_dispose(&vtpm);
>           return 1;
>       }
>       libxl_device_vtpm_dispose(&vtpm);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xl: properly dispose of vTPM struct instance
  2025-01-14  8:13 [PATCH] xl: properly dispose of vTPM struct instance Jan Beulich
  2025-01-14  9:28 ` Andrew Cooper
  2025-01-14 11:25 ` Oleksii Kurochko
@ 2025-01-16 13:12 ` Anthony PERARD
  2 siblings, 0 replies; 4+ messages in thread
From: Anthony PERARD @ 2025-01-16 13:12 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Oleksii Kurochko

On Tue, Jan 14, 2025 at 09:13:16AM +0100, Jan Beulich wrote:
> The backend_domname field requires separate freeing; make sure to call
> libxl_device_vtpm_dispose() also on respective error paths.
> 
> Coverity-ID: 1638719
> Fixes: dde22055ac3a ("libxl: add vtpm support")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks,

-- 

Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-16 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14  8:13 [PATCH] xl: properly dispose of vTPM struct instance Jan Beulich
2025-01-14  9:28 ` Andrew Cooper
2025-01-14 11:25 ` Oleksii Kurochko
2025-01-16 13:12 ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.