]> git.baikalelectronics.ru Git - kernel.git/commit
ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
authorLv Yunlong <lyl2019@mail.ustc.edu.cn>
Mon, 24 May 2021 09:32:05 +0000 (02:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jul 2021 06:53:17 +0000 (08:53 +0200)
commit33b0e462e59041551ebf473da5798571f1a44a71
tree6f8ef35dbbccfa8b7d7f15644b19803ed9c1bc11
parent0484c6e9c293202d7af064d158957e1e92364b87
ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe

commit 9272e5d0028d45a3b45b58c9255e6e0df53f7ad9 upstream.

In the out_err_bus_register error branch of tpci200_pci_probe,
tpci200->info->cfg_regs is freed by tpci200_uninstall()->
tpci200_unregister()->pci_iounmap(..,tpci200->info->cfg_regs)
in the first time.

But later, iounmap() is called to free tpci200->info->cfg_regs
again.

My patch sets tpci200->info->cfg_regs to NULL after tpci200_uninstall()
to avoid the double free.

Fixes: 4e1af66d9f722 ("Staging: ipack/bridges/tpci200: Use the TPCI200 in big endian mode")
Cc: stable <stable@vger.kernel.org>
Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Link: https://lore.kernel.org/r/20210524093205.8333-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ipack/carriers/tpci200.c