linux/drivers/nvdimm
Abdun Nihaal eeb95774bc nvdimm/btt: Free arena sub-allocations on discover_arenas() error path
commit 13fe4cd9dd upstream.

Memory allocated by btt_freelist_init(), btt_rtt_init(), and
btt_maplocks_init() is not freed on some discover_arenas() error
paths. This leaks memory when arena discovery fails.

Add the missing kfree() calls to release the allocations before
returning an error.

[ as: commit message and log edits ]

Fixes: 5212e11fde ("nd_btt: atomic sector updates")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20260519-nvdimmleaks-v1-1-592300fb7a43@cse.iitm.ac.in
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-07-24 15:51:48 +02:00
..
badrange.c mm/memremap_pages: convert to 'struct range' 2020-10-13 18:38:28 -07:00
blk.c nvdimm-blk: convert to blk_alloc_disk/blk_cleanup_disk 2021-06-01 07:42:23 -06:00
btt.c nvdimm/btt: Free arena sub-allocations on discover_arenas() error path 2026-07-24 15:51:48 +02:00
btt.h nvdimm-btt: convert to blk_alloc_disk/blk_cleanup_disk 2021-06-01 07:42:23 -06:00
btt_devs.c libnvdimm: Move attribute groups to device type 2019-11-17 09:17:38 -08:00
bus.c nvdimm/bus: Fix potential use after free in asynchronous initialization 2026-04-18 10:33:17 +02:00
claim.c libnvdimm: Cleanup include of badblocks.h 2020-12-15 21:47:45 -08:00
core.c nvdimm: Fix firmware activation deadlock scenarios 2022-06-09 10:23:08 +02:00
dax_devs.c nvdimm: rectify the illogical code within nd_dax_probe() 2024-12-14 19:51:41 +01:00
dimm.c libnvdimm: Make remove callback return void 2021-02-16 19:35:29 -08:00
dimm_devs.c libnvdimm: Export nvdimm shutdown helper, nvdimm_delete() 2021-06-15 16:47:22 -07:00
e820.c libnvdimm/e820: Retrieve and populate correct 'target_node' info 2020-02-18 10:28:05 -08:00
Kconfig lib: Uplevel the pmem "region" ida to a global allocator 2019-11-07 15:44:29 +01:00
label.c libnvdimm/labels: Fix divide error in nd_label_data_init() 2025-06-04 14:37:55 +02:00
label.h libnvdimm/labels: Add claim class helpers 2021-08-24 12:08:28 -07:00
Makefile libnvdimm: Enable unit test infrastructure compile checks 2019-09-07 04:28:05 -03:00
namespace_devs.c cxl for v5.15 2021-09-09 11:48:27 -07:00
nd-core.h PM, libnvdimm: Add runtime firmware activation support 2020-07-28 19:28:32 -06:00
nd.h nvdimm: rectify the illogical code within nd_dax_probe() 2024-12-14 19:51:41 +01:00
nd_virtio.c nvdimm: virtio_pmem: serialize flush requests 2026-03-04 07:19:44 -05:00
of_pmem.c libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value 2023-11-20 11:08:22 +01:00
pfn.h libnvdimm/namespace: Enforce memremap_compat_align() 2020-03-17 12:23:21 -07:00
pfn_devs.c mm/memremap_pages: support multiple ranges per invocation 2020-10-13 18:38:28 -07:00
pmem.c nvdimm/pmem: cleanup the disk if pmem_release_disk() is yet assigned 2021-11-18 19:17:07 +01:00
pmem.h libnvdimm, pmem: Restore page attributes when clearing errors 2018-08-20 09:22:45 -07:00
region.c libnvdimm: Make remove callback return void 2021-02-16 19:35:29 -08:00
region_devs.c nd_btt: Make BTT lanes preemptible 2023-11-20 11:08:22 +01:00
security.c nvdimm: Allow overwrite in the presence of disabled dimms 2022-06-09 10:23:08 +02:00
virtio_pmem.c nvdimm: virtio_pmem: serialize flush requests 2026-03-04 07:19:44 -05:00
virtio_pmem.h nvdimm: virtio_pmem: serialize flush requests 2026-03-04 07:19:44 -05:00