* [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge
@ 2026-07-04 6:58 Hao-Qun Huang
2026-07-04 6:58 ` [PATCH 2/2] staging: vme_user: fix location monitor leak in tsi148 bridge Hao-Qun Huang
2026-07-09 10:50 ` [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge Dan Carpenter
0 siblings, 2 replies; 4+ messages in thread
From: Hao-Qun Huang @ 2026-07-04 6:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Johan Hovold, Kees Cook, Nadzeya Hutsko, linux-staging,
linux-kernel, Hao-Qun Huang, stable, Martyn Welch
fake_init() allocates a location monitor resource and links it into
fake_bridge->lm_resources. The init error path frees this list, but
fake_exit() only frees the slave and master resource lists. Loading
and unloading the module therefore triggers a kmemleak warning:
unreferenced object 0xffff8b8b82aebe40 (size 64):
comm "init", pid 1, jiffies 4294894572
backtrace (crc c1e013ef):
kmemleak_alloc+0x4e/0x90
__kmalloc_cache_noprof+0x338/0x430
0xffffffffc0602246
do_one_initcall+0x4f/0x320
do_init_module+0x68/0x270
load_module+0x2a3b/0x2d90
Free the lm_resources list in fake_exit() as well, before fake_bridge
is freed.
Fixes: 658bcdae9c67 ("vme: Adding Fake VME driver")
Cc: stable@vger.kernel.org # 4.9
Cc: Martyn Welch <martyn@welchs.me.uk>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com>
---
diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
index 8abaa3165fbb..434cf760ade6 100644
--- a/drivers/staging/vme_user/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -1239,6 +1239,7 @@ static void __exit fake_exit(void)
{
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;
int i;
@@ -1268,6 +1269,13 @@ static void __exit fake_exit(void)
vme_unregister_bridge(fake_bridge);
fake_crcsr_exit(fake_bridge);
+ /* resources are stored in link list */
+ list_for_each_safe(pos, tmplist, &fake_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, &fake_bridge->slave_resources) {
slave_image = list_entry(pos, struct vme_slave_resource, list);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] staging: vme_user: fix location monitor leak in tsi148 bridge
2026-07-04 6:58 [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge Hao-Qun Huang
@ 2026-07-04 6:58 ` Hao-Qun Huang
2026-07-09 10:50 ` [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Hao-Qun Huang @ 2026-07-04 6:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Johan Hovold, Kees Cook, Nadzeya Hutsko, linux-staging,
linux-kernel, Hao-Qun Huang, stable, Martyn Welch
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: d22b8ed9a3b0 ("Staging: vme: add Tundra TSI148 VME-PCI Bridge driver")
Cc: stable@vger.kernel.org
Cc: Martyn Welch <martyn@welchs.me.uk>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com>
---
diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
index 4cf3486646ce..c695ad9b4ca2 100644
--- a/drivers/staging/vme_user/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -2534,6 +2534,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;
@@ -2590,6 +2591,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);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge
2026-07-04 6:58 [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge Hao-Qun Huang
2026-07-04 6:58 ` [PATCH 2/2] staging: vme_user: fix location monitor leak in tsi148 bridge Hao-Qun Huang
@ 2026-07-09 10:50 ` Dan Carpenter
2026-07-09 11:03 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2026-07-09 10:50 UTC (permalink / raw)
To: Hao-Qun Huang
Cc: Greg Kroah-Hartman, Johan Hovold, Kees Cook, Nadzeya Hutsko,
linux-staging, linux-kernel, stable, Martyn Welch
Hi Greg, I'm back from travel. Should we just delete staging/vme_user/?
I don't know really if it's used but there are some pretty severe
security issues with this code.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge
2026-07-09 10:50 ` [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge Dan Carpenter
@ 2026-07-09 11:03 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-09 11:03 UTC (permalink / raw)
To: Dan Carpenter
Cc: Hao-Qun Huang, Johan Hovold, Kees Cook, Nadzeya Hutsko,
linux-staging, linux-kernel, stable, Martyn Welch
On Thu, Jul 09, 2026 at 01:50:16PM +0300, Dan Carpenter wrote:
> Hi Greg, I'm back from travel. Should we just delete staging/vme_user/?
> I don't know really if it's used but there are some pretty severe
> security issues with this code.
There are probably lots of issues with this code, but from what I
recall, the systems that use this do not have "untrusted" userspace
processes on it, so it shouldn't be an issue. If that's not the case,
then yes, it should be deleted, but really, no one cares about security
issues with code that adds TAINT_CRAP to the system when loaded :)
Martyn, any thoughts?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-09 11:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-04 6:58 [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge Hao-Qun Huang
2026-07-04 6:58 ` [PATCH 2/2] staging: vme_user: fix location monitor leak in tsi148 bridge Hao-Qun Huang
2026-07-09 10:50 ` [PATCH 1/2] staging: vme_user: fix location monitor leak in fake bridge Dan Carpenter
2026-07-09 11:03 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox