Skip to content

Commit 13fe4cd

Browse files
Abdun NihaalAlisonSchofield
authored andcommitted
nvdimm/btt: Free arena sub-allocations on discover_arenas() error path
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: 5212e11 ("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>
1 parent 8d4b989 commit 13fe4cd

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/nvdimm/btt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,9 @@ static int discover_arenas(struct btt *btt)
919919
return ret;
920920

921921
out:
922+
kfree(arena->freelist);
923+
kfree(arena->rtt);
924+
kfree(arena->map_locks);
922925
kfree(arena);
923926
free_arenas(btt);
924927
return ret;

0 commit comments

Comments
 (0)