On Sun, Jan 20, 2019 at 4:51 PM Wei Yang <[email protected]> wrote:
[..]
> >I also don't see that this fix is needed. nd_dax_probe()
> >devm-allocates pfn_sb and performs a validation. If the validation
> >succeeds nd_dax_probe() returns 0 which creates a new device and then
> >causes nd_pmem_probe() to fail. At that point devm frees the pfn_sb
>
> If I am correct, nd_dax_probe() creates a device whose driver is
> dax_pmem_driver. So the probe function is dax_pmem_probe.
>
> Based on my test, one more pfn_sb is allocated in dax_pmem_probe and the
> driver attached to the device successfully.
>
> >allocation. The allocation is also freed if the validation step
> >failed.
>
> nd_pmem_probe() will be called on device created by nd_btt_probe() and
> nd_pfn_probe(), if I am right.
>
> So in which case these two driver will fail to to attach the device and
> release the memory?
See nd_pmem_probe():
/* if we find a valid info-block we'll come back as that personality */
if (nd_btt_probe(dev, ndns) == 0 || nd_pfn_probe(dev, ndns) == 0
|| nd_dax_probe(dev, ndns) == 0)
return -ENXIO;
...all devm allocations are released due to that "return -ENXIO".
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm