[PATCH v1] libxl: fix refcounting in libxlDomainChangeEjectableMedia

Olaf Hering posted 1 patch 2 years, 11 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210518192631.5054-1-olaf@aepfle.de
src/libxl/libxl_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] libxl: fix refcounting in libxlDomainChangeEjectableMedia
Posted by Olaf Hering 2 years, 11 months ago
The initial variant of libxlDomainChangeEjectableMedia could just leave
the function earlier. With refcounting this does not work anymore.

Fixes commit a5bf06ba34dbb226ac1b2fb63f5026c5d493bc65

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 src/libxl/libxl_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 99a170ff2a..d54cd41785 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2997,7 +2997,7 @@ libxlDomainChangeEjectableMedia(virDomainObj *vm, virDomainDiskDef *disk)
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Removable media not supported for %s device"),
                        virDomainDiskDeviceTypeToString(disk->device));
-        return -1;
+        goto cleanup;
     }
 
     if (libxlMakeDisk(disk, &x_disk) < 0)

Re: [PATCH v1] libxl: fix refcounting in libxlDomainChangeEjectableMedia
Posted by Jim Fehlig 2 years, 11 months ago
On 5/18/21 1:26 PM, Olaf Hering wrote:
> The initial variant of libxlDomainChangeEjectableMedia could just leave
> the function earlier. With refcounting this does not work anymore.
> 
> Fixes commit a5bf06ba34dbb226ac1b2fb63f5026c5d493bc65
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

Reviewed-by: Jim Fehlig <jfehlig@suse.com>

> ---
>   src/libxl/libxl_driver.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 99a170ff2a..d54cd41785 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -2997,7 +2997,7 @@ libxlDomainChangeEjectableMedia(virDomainObj *vm, virDomainDiskDef *disk)
>           virReportError(VIR_ERR_INTERNAL_ERROR,
>                          _("Removable media not supported for %s device"),
>                          virDomainDiskDeviceTypeToString(disk->device));
> -        return -1;
> +        goto cleanup;
>       }
>   
>       if (libxlMakeDisk(disk, &x_disk) < 0)
>