* [char-misc-next] mei: bus: fix device leak
@ 2025-06-24 7:15 Alexander Usyskin
2025-06-24 9:06 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Usyskin @ 2025-06-24 7:15 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Reuven Abliyev, Alexander Usyskin, linux-kernel
The bus rescan function creates bus devices for all clients.
The fixup routine is executed on all devices, unneeded
devices are removed and fully initialized once set
is_added flag to 1.
If link to firmware is reset right after all devices are
initialized, but before fixup is executed, the rescan tries
to remove devices.
The is_added flag is not set and the mei_cl_bus_dev_destroy
returns prematurely.
Allow to clean up device when is_added flag is unset to
account for above scenario.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
---
drivers/misc/mei/bus.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 67176caf5416..f2e5d550c6b4 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -1430,17 +1430,14 @@ static void mei_cl_bus_dev_stop(struct mei_cl_device *cldev)
*/
static void mei_cl_bus_dev_destroy(struct mei_cl_device *cldev)
{
-
WARN_ON(!mutex_is_locked(&cldev->bus->cl_bus_lock));
- if (!cldev->is_added)
- return;
-
- device_del(&cldev->dev);
+ if (cldev->is_added) {
+ device_del(&cldev->dev);
+ cldev->is_added = 0;
+ }
list_del_init(&cldev->bus_list);
-
- cldev->is_added = 0;
put_device(&cldev->dev);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [char-misc-next] mei: bus: fix device leak
2025-06-24 7:15 [char-misc-next] mei: bus: fix device leak Alexander Usyskin
@ 2025-06-24 9:06 ` Greg Kroah-Hartman
2025-06-24 9:39 ` Usyskin, Alexander
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2025-06-24 9:06 UTC (permalink / raw)
To: Alexander Usyskin; +Cc: Reuven Abliyev, linux-kernel
On Tue, Jun 24, 2025 at 10:15:21AM +0300, Alexander Usyskin wrote:
> The bus rescan function creates bus devices for all clients.
> The fixup routine is executed on all devices, unneeded
> devices are removed and fully initialized once set
> is_added flag to 1.
>
> If link to firmware is reset right after all devices are
> initialized, but before fixup is executed, the rescan tries
> to remove devices.
> The is_added flag is not set and the mei_cl_bus_dev_destroy
> returns prematurely.
> Allow to clean up device when is_added flag is unset to
> account for above scenario.
>
> Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
What commit id does this fix?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [char-misc-next] mei: bus: fix device leak
2025-06-24 9:06 ` Greg Kroah-Hartman
@ 2025-06-24 9:39 ` Usyskin, Alexander
0 siblings, 0 replies; 3+ messages in thread
From: Usyskin, Alexander @ 2025-06-24 9:39 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Abliyev, Reuven, linux-kernel@vger.kernel.org
> Subject: Re: [char-misc-next] mei: bus: fix device leak
>
> On Tue, Jun 24, 2025 at 10:15:21AM +0300, Alexander Usyskin wrote:
> > The bus rescan function creates bus devices for all clients.
> > The fixup routine is executed on all devices, unneeded
> > devices are removed and fully initialized once set
> > is_added flag to 1.
> >
> > If link to firmware is reset right after all devices are
> > initialized, but before fixup is executed, the rescan tries
> > to remove devices.
> > The is_added flag is not set and the mei_cl_bus_dev_destroy
> > returns prematurely.
> > Allow to clean up device when is_added flag is unset to
> > account for above scenario.
> >
> > Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
>
> What commit id does this fix?
>
> thanks,
>
> greg k-h
This is the one that introduces this function:
commit 6009595a66e4 ("mei: bus: link client devices instead of host clients")
Will send v2 with Fixes tag.
- -
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-24 9:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 7:15 [char-misc-next] mei: bus: fix device leak Alexander Usyskin
2025-06-24 9:06 ` Greg Kroah-Hartman
2025-06-24 9:39 ` Usyskin, Alexander
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.