Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-08-18 Thread Zhijian Li (Fujitsu)
On 10/08/2024 06:55, Dan Williams wrote: > Dan Williams wrote: > [..] >> @@ -2036,12 +2038,10 @@ static struct device **scan_labels(struct nd_region >> *nd_region) > > ...of course you would also need something like: > > if (!count) { > kfree(devs); > return NULL; > } It seems we

Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-08-18 Thread Zhijian Li (Fujitsu)
(Just back from the summer holiday) Sorry for the late reply. On 10/08/2024 06:38, Dan Williams wrote: > I notice this patch is not upstream yet. Let's try to get it over the > goal line. > > Li Zhijian wrote: >> The leakage would happen when create_namespace_pmem() meets an invalid >> label wh

Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-08-09 Thread Dan Williams
Dan Williams wrote: [..] > @@ -2036,12 +2038,10 @@ static struct device **scan_labels(struct nd_region > *nd_region) ...of course you would also need something like: if (!count) { kfree(devs); return NULL; } ...here, I'll leave that to you to fix up and test. > return d

Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-08-09 Thread Dan Williams
I notice this patch is not upstream yet. Let's try to get it over the goal line. Li Zhijian wrote: > The leakage would happend when create_namespace_pmem() meets an invalid > label which gets failure in validating isetcookie. I would rewrite this as: "scan_labels() leaks memory when label scanni

Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-07-28 Thread Zhijian Li (Fujitsu)
On 26/07/2024 21:37, Ira Weiny wrote: > Li Zhijian wrote: >> The leakage would happend when create_namespace_pmem() meets an invalid >> label which gets failure in validating isetcookie. >> >> Try to resuse the devs that may have already been allocated with size >> (2 * sizeof(dev)) previously. >

Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-07-26 Thread Ira Weiny
Li Zhijian wrote: > The leakage would happend when create_namespace_pmem() meets an invalid > label which gets failure in validating isetcookie. > > Try to resuse the devs that may have already been allocated with size > (2 * sizeof(dev)) previously. > > A kmemleak reports: > unreferenced object

[PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-07-18 Thread Li Zhijian
The leakage would happend when create_namespace_pmem() meets an invalid label which gets failure in validating isetcookie. Try to resuse the devs that may have already been allocated with size (2 * sizeof(dev)) previously. A kmemleak reports: unreferenced object 0x88800dda1980 (size 16): co