Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

remoteproc: fix memory leak of remoteproc ida cache layers

The remoteproc core uses a static ida named rproc_dev_index for
assigning an automatic index number to a registered remoteproc.
The ida core may allocate some internal idr cache layers and ida
bitmap upon any ida allocation, and all these layers are truely
freed only upon the ida destruction. The rproc_dev_index ida is
not destroyed at present, leading to a memory leak when using the
remoteproc core as a module and atleast one rproc device is
registered and unregistered.

Fix this by invoking ida_destroy() in the remoteproc core module
exit.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>

authored by

Suman Anna and committed by
Ohad Ben-Cohen
f42f79af 92792e48

+2
+2
drivers/remoteproc/remoteproc_core.c
··· 1478 1478 1479 1479 static void __exit remoteproc_exit(void) 1480 1480 { 1481 + ida_destroy(&rproc_dev_index); 1482 + 1481 1483 rproc_exit_debugfs(); 1482 1484 } 1483 1485 module_exit(remoteproc_exit);