This fix will not work, as daxctl_ctx is freed before free_dax() and 
daxctl_region_unref() tries to update daxctl_ctx. 

> -----Original Message-----
> From: Linux-nvdimm [mailto:linux-nvdimm-boun...@lists.01.org] On Behalf
> Of Dan Williams
> Sent: Friday, February 2, 2018 09:29
> To: linux-nvdimm@lists.01.org
> Subject: [ndctl PATCH] ndctl: fix leak of daxctl_region instances
> 
> The daxctl_region returned by ndctl_dax_get_daxctl_region() should be
> automatically freed when its parent infrastructure is torn down.
> 
> Reported-by: Lukasz Plewa <lukasz.pl...@intel.com>
> Signed-off-by: Dan Williams <dan.j.willi...@intel.com>
> ---
>  ndctl/lib/libndctl.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index
> 4119a2e6b564..9314e8b8f81b 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -434,6 +434,7 @@ static void free_pfn(struct ndctl_pfn *pfn, struct
> list_head *head)
> 
>  static void free_dax(struct ndctl_dax *dax, struct list_head *head)  {
> +     daxctl_region_unref(dax->region);
>       __free_pfn(&dax->pfn, head, dax);
>  }
> 
> 
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to