Re: [PATCH] media: chips-media: wave5: Fix Potential Probe Resource Leak
From: Brandon Brnich
Date: Thu Dec 11 2025 - 17:55:59 EST
Hi,
On 12/11/2025 3:51 PM, Nicolas Dufresne wrote:
Le jeudi 11 décembre 2025 à 15:36 -0600, Brandon Brnich a écrit :
err_irq_release:
if (dev->irq < 0) {
kthread_destroy_worker(dev->worker);
hrtimer_cancel(&dev->hrtimer);
}
err_vdi_release:
That's seems more then just a suggestion, I see that err_vdi_release: is reached
on worker creation failure. Checking the kthread code, this will cause a use
after free instead of a leak.
Agreed with all above statements. I will update to fix use after free
that I introduced in v1.
An additional question, aren't we are supposed to also cleanup irq_thread ? We
have this code being introduced in the remove function now:
if (dev->irq_thread) {
kthread_stop(dev->irq_thread);
up(&dev->irq_sem);
dev->irq_thread = NULL;
}
This portion of code is being introduced in Jackson's performance
series. I did not base my patch on this series since it hasn't been
accepted yet. I assumed my patch would make it in before since this is
easier to review than that series. Apologies if I need to base on that
series. Can rebase this in v2 if requested.
Otherwise, I suggest Jackson to add irq_thread cleanup in next iteration
of performance series.
I see, this is good point. I discourage writing code against my upcoming PR
branch, its not a proper tree, but for this one you may just base you patch
against it, since it will all be sent together ideally.
https://gitlab.freedesktop.org/linux-media/users/ndufresne/-/tree/for-6.20
Will do. Since I am rebasing on this tree I will also just handle the irq thread cleanup in my v2.
Best,
Brandon
regards,
Nicolas