mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
staging: vme_user: fix location monitor leak in tsi148 bridge
commit151edde741upstream. tsi148_probe() allocates a location monitor resource and links it into tsi148_bridge->lm_resources. The probe error path frees this list, but tsi148_remove() only frees the dma, slave and master resource lists, so the location monitor resource is leaked on device unbind or module unload. Free the lm_resources list in tsi148_remove() as well, before tsi148_bridge is freed. Fixes:d22b8ed9a3("Staging: vme: add Tundra TSI148 VME-PCI Bridge driver") Cc: stable <stable@kernel.org> Cc: Martyn Welch <martyn@welchs.me.uk> Assisted-by: Claude:claude-fable-5 Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com> Link: https://patch.msgid.link/20260704065817.403111-2-alvinhuang0603@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0471a3c725
commit
eef048dd77
@@ -2538,6 +2538,7 @@ static void tsi148_remove(struct pci_dev *pdev)
|
||||
{
|
||||
struct list_head *pos = NULL;
|
||||
struct list_head *tmplist;
|
||||
struct vme_lm_resource *lm;
|
||||
struct vme_master_resource *master_image;
|
||||
struct vme_slave_resource *slave_image;
|
||||
struct vme_dma_resource *dma_ctrlr;
|
||||
@@ -2594,6 +2595,13 @@ static void tsi148_remove(struct pci_dev *pdev)
|
||||
|
||||
tsi148_crcsr_exit(tsi148_bridge, pdev);
|
||||
|
||||
/* resources are stored in link list */
|
||||
list_for_each_safe(pos, tmplist, &tsi148_bridge->lm_resources) {
|
||||
lm = list_entry(pos, struct vme_lm_resource, list);
|
||||
list_del(pos);
|
||||
kfree(lm);
|
||||
}
|
||||
|
||||
/* resources are stored in link list */
|
||||
list_for_each_safe(pos, tmplist, &tsi148_bridge->dma_resources) {
|
||||
dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
|
||||
|
||||
Reference in New Issue
Block a user