qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pvrdma: release device resources in case of an error
@ 2018-12-12 17:58 P J P
  2018-12-12 19:08 ` Yuval Shaia
  0 siblings, 1 reply; 2+ messages in thread
From: P J P @ 2018-12-12 17:58 UTC (permalink / raw)
  To: Yuval Shaia; +Cc: Qemu Developers, Marcel Apfelbaum, Li Qiang, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

If during pvrdma device initialisation an error occurs,
pvrdma_realize() does not release memory resources, leading
to memory leakage.

Reported-by: Li Qiang <liq3ea@163.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 hw/rdma/vmw/pvrdma_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
index 8a03ab4669..b65f8662df 100644
--- a/hw/rdma/vmw/pvrdma_main.c
+++ b/hw/rdma/vmw/pvrdma_main.c
@@ -579,7 +579,7 @@ static void pvrdma_shutdown_notifier(Notifier *n, void *opaque)
 
 static void pvrdma_realize(PCIDevice *pdev, Error **errp)
 {
-    int rc;
+    int rc = 0;
     PVRDMADev *dev = PVRDMA_DEV(pdev);
     Object *memdev_root;
     bool ram_shared = false;
@@ -655,6 +655,7 @@ static void pvrdma_realize(PCIDevice *pdev, Error **errp)
 
 out:
     if (rc) {
+        pvrdma_fini(pdev);
         error_append_hint(errp, "Device fail to load\n");
     }
 }
-- 
2.19.2

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

* Re: [Qemu-devel] [PATCH] pvrdma: release device resources in case of an error
  2018-12-12 17:58 [Qemu-devel] [PATCH] pvrdma: release device resources in case of an error P J P
@ 2018-12-12 19:08 ` Yuval Shaia
  0 siblings, 0 replies; 2+ messages in thread
From: Yuval Shaia @ 2018-12-12 19:08 UTC (permalink / raw)
  To: P J P
  Cc: Qemu Developers, Marcel Apfelbaum, Li Qiang, Prasad J Pandit,
	yuval.shaia

On Wed, Dec 12, 2018 at 11:28:17PM +0530, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
> 
> If during pvrdma device initialisation an error occurs,
> pvrdma_realize() does not release memory resources, leading
> to memory leakage.
> 
> Reported-by: Li Qiang <liq3ea@163.com>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> ---
>  hw/rdma/vmw/pvrdma_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
> index 8a03ab4669..b65f8662df 100644
> --- a/hw/rdma/vmw/pvrdma_main.c
> +++ b/hw/rdma/vmw/pvrdma_main.c
> @@ -579,7 +579,7 @@ static void pvrdma_shutdown_notifier(Notifier *n, void *opaque)
>  
>  static void pvrdma_realize(PCIDevice *pdev, Error **errp)
>  {
> -    int rc;
> +    int rc = 0;
>      PVRDMADev *dev = PVRDMA_DEV(pdev);
>      Object *memdev_root;
>      bool ram_shared = false;
> @@ -655,6 +655,7 @@ static void pvrdma_realize(PCIDevice *pdev, Error **errp)
>  
>  out:
>      if (rc) {
> +        pvrdma_fini(pdev);
>          error_append_hint(errp, "Device fail to load\n");
>      }

Thanks.

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

>  }
> -- 
> 2.19.2
> 

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

end of thread, other threads:[~2018-12-12 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-12 17:58 [Qemu-devel] [PATCH] pvrdma: release device resources in case of an error P J P
2018-12-12 19:08 ` Yuval Shaia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).