Re: [GIT PULL] DAX and HMAT fixes for v6.1-rc8

2022-12-03 Thread pr-tracker-bot
The pull request you sent on Fri, 2 Dec 2022 18:48:02 -0800:

> git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm 
> tags/dax-fixes-6.1-rc8

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/6085bc95797caa55a68bc0f7dd73e8c33e91037f

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html



Re: [PATCH] dax/hmem: Fix refcount leak in dax_hmem_probe()

2022-12-03 Thread Ira Weiny
On Sat, Dec 03, 2022 at 09:58:58AM +, Yongqiang Liu wrote:
> We should always call dax_region_put() whenever devm_create_dev_dax()
> succeed or fail to avoid refcount leak of dax_region. Move the return
> value check after dax_region_put().

I think dax_region_put is called from dax_region_unregister() automatically on
tear down.

> 
> Fixes: c01044cc8191 ("ACPI: HMAT: refactor hmat_register_target_device to 
> hmem_register_device")

I'm also not sure how this patch is related to this fix.

Ira

> Signed-off-by: Yongqiang Liu 
> ---
>  drivers/dax/hmem/hmem.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem/hmem.c
> index 1bf040dbc834..09f5cd7b6c8e 100644
> --- a/drivers/dax/hmem/hmem.c
> +++ b/drivers/dax/hmem/hmem.c
> @@ -36,12 +36,11 @@ static int dax_hmem_probe(struct platform_device *pdev)
>   .size = region_idle ? 0 : resource_size(res),
>   };
>   dev_dax = devm_create_dev_dax();
> - if (IS_ERR(dev_dax))
> - return PTR_ERR(dev_dax);
>  
>   /* child dev_dax instances now own the lifetime of the dax_region */
>   dax_region_put(dax_region);
> - return 0;
> +
> + return IS_ERR(dev_dax) ? PTR_ERR(dev_dax) : 0;
>  }
>  
>  static int dax_hmem_remove(struct platform_device *pdev)
> -- 
> 2.25.1
> 
> 



[PATCH] dax/hmem: Fix refcount leak in dax_hmem_probe()

2022-12-03 Thread Yongqiang Liu
We should always call dax_region_put() whenever devm_create_dev_dax()
succeed or fail to avoid refcount leak of dax_region. Move the return
value check after dax_region_put().

Fixes: c01044cc8191 ("ACPI: HMAT: refactor hmat_register_target_device to 
hmem_register_device")
Signed-off-by: Yongqiang Liu 
---
 drivers/dax/hmem/hmem.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem/hmem.c
index 1bf040dbc834..09f5cd7b6c8e 100644
--- a/drivers/dax/hmem/hmem.c
+++ b/drivers/dax/hmem/hmem.c
@@ -36,12 +36,11 @@ static int dax_hmem_probe(struct platform_device *pdev)
.size = region_idle ? 0 : resource_size(res),
};
dev_dax = devm_create_dev_dax();
-   if (IS_ERR(dev_dax))
-   return PTR_ERR(dev_dax);
 
/* child dev_dax instances now own the lifetime of the dax_region */
dax_region_put(dax_region);
-   return 0;
+
+   return IS_ERR(dev_dax) ? PTR_ERR(dev_dax) : 0;
 }
 
 static int dax_hmem_remove(struct platform_device *pdev)
-- 
2.25.1