]> git.baikalelectronics.ru Git - kernel.git/commit
coresight: configfs: Fix unload of configurations on module exit
authorMike Leach <mike.leach@linaro.org>
Tue, 28 Jun 2022 17:30:03 +0000 (18:30 +0100)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Wed, 29 Jun 2022 15:31:08 +0000 (09:31 -0600)
commit0c8e815e025e019905e577c3d95f1825d204d2e6
tree10c446c262fbaba90d1e273f138fa2f0aff2aa77
parent5e7e2c722021885ef312da08f7b9b94b332c3e7a
coresight: configfs: Fix unload of configurations on module exit

Any loaded configurations must be correctly unloaded on coresight module
exit, or issues can arise with nested locking in the configfs directory
code if built with CONFIG_LOCKDEP.

Prior to this patch, the preloaded configuration configfs directory entries
were being unloaded by the recursive code in
configfs_unregister_subsystem().

However, when built with CONFIG_LOCKDEP, this caused a nested lock warning,
which was not mitigated by the LOCKDEP dependent code in fs/configfs/dir.c
designed to prevent this, due to the different directory levels for the
root of the directory being removed.

As the preloaded (and all other) configurations are registered after
configfs_register_subsystem(), we now explicitly unload them before the
call to configfs_unregister_subsystem().

The new routine cscfg_unload_cfgs_on_exit() iterates through the load
owner list to unload any remaining configurations that were not unloaded
by the user before the module exits. This covers both the
CSCFG_OWNER_PRELOAD and CSCFG_OWNER_MODULE owner types, and will be
extended to cover future load owner types for CoreSight configurations.

Fixes: c54269905417 ("coresight: syscfg: Update load API for config loadable modules")
Reported-by: Suzuki Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-and-tested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20220628173004.30002-2-mike.leach@linaro.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/hwtracing/coresight/coresight-syscfg.c