ipack: tpci200: fix memory leak in the tpci200_register
authorDongliang Mu <mudongliangabcd@gmail.com>
Tue, 10 Aug 2021 10:03:19 +0000 (18:03 +0800)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:35:55 +0000 (08:35 -0400)
commit258782b937014f920d66776e382d6648f8909810
tree109e38f35fad39be92a6be03a9e0e20349d70c99
parent3ee1b08097c1a458216684070c1ad398300e8501
ipack: tpci200: fix memory leak in the tpci200_register

[ Upstream commit 50f05bd114a46a74726e432bf81079d3f13a55b7 ]

The error handling code in tpci200_register does not free interface_regs
allocated by ioremap and the current version of error handling code is
problematic.

Fix this by refactoring the error handling code and free interface_regs
when necessary.

Fixes: 43986798fd50 ("ipack: add error handling for ioremap_nocache")
Cc: stable@vger.kernel.org
Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Link: https://lore.kernel.org/r/20210810100323.3938492-2-mudongliangabcd@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ipack/carriers/tpci200.c