Skip to content

Commit 151edde

Browse files
alvin0603gregkh
authored andcommitted
staging: vme_user: fix location monitor leak in tsi148 bridge
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: d22b8ed ("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>
1 parent e8422d8 commit 151edde

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/staging/vme_user/vme_tsi148.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,7 @@ static void tsi148_remove(struct pci_dev *pdev)
25342534
{
25352535
struct list_head *pos = NULL;
25362536
struct list_head *tmplist;
2537+
struct vme_lm_resource *lm;
25372538
struct vme_master_resource *master_image;
25382539
struct vme_slave_resource *slave_image;
25392540
struct vme_dma_resource *dma_ctrlr;
@@ -2590,6 +2591,13 @@ static void tsi148_remove(struct pci_dev *pdev)
25902591

25912592
tsi148_crcsr_exit(tsi148_bridge, pdev);
25922593

2594+
/* resources are stored in link list */
2595+
list_for_each_safe(pos, tmplist, &tsi148_bridge->lm_resources) {
2596+
lm = list_entry(pos, struct vme_lm_resource, list);
2597+
list_del(pos);
2598+
kfree(lm);
2599+
}
2600+
25932601
/* resources are stored in link list */
25942602
list_for_each_safe(pos, tmplist, &tsi148_bridge->dma_resources) {
25952603
dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);

0 commit comments

Comments
 (0)