Paul Cassella wrote:
> On Fri, 2 Jun 2023, Ira Weiny wrote:
> > Paul Cassella wrote:
> > > On Sat, 3 Dec 2022, Ira Weiny wrote:
> > > > 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
All the callers to alloc_dax_region() maintain the device associated
with the dax_region until the dax_region is referenced by the dax_dev
they are creating.
Remove the extra kref that alloc_dax_region() takes. Add a comment to
clarify the reference counting should additional callers be grown lat
alloc_dax_region() returns a reference protected dax_region. Regardless
of the success of the devm_create_dev_dax() the reference returned from
alloc_dax_region() needs to be released.
Drop the dax_region reference regardless of the success of dev_dax
creation. Clean up comments.
Fixes: 09d09e0
kref_init() initializes the ref count to 1. An extra kref is taken on
the dax_region to be used by the caller. If devm_add_action_or_reset()
fails this extra reference is leaked.
Drop the extra reference on error.
Fixes: d7fe1a67f658 ("dax: add region 'id', 'size', and 'align' attributes")
Cc:
From: 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().
Cc: nvd...@lists.linux.dev
Fixes: c01044cc8191 ("ACPI: HMAT: refactor hmat_register_target_device to
8967acc1d9
change-id: 20230602-dax-region-put-72c289137cb1
Best regards,
--
Ira Weiny
Paul Cassella wrote:
> On Fri, 2 Jun 2023, Ira Weiny wrote:
> > Paul Cassella wrote:
> > > On Sat, 3 Dec 2022, Ira Weiny wrote:
> > > > 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
On Fri, 2 Jun 2023, Ira Weiny wrote:
> Paul Cassella wrote:
> > On Sat, 3 Dec 2022, Ira Weiny wrote:
> > > 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
Paul Cassella wrote:
> On Sat, 3 Dec 2022, Ira Weiny wrote:
> > 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
9 matches
Mail list logo