aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-mod.c
diff options
context:
space:
mode:
authorMasahiro Yamada <[email protected]>2022-09-23 20:38:35 +0900
committerChristoph Hellwig <[email protected]>2022-09-23 16:46:19 +0200
commitf7f04d198334d6f69c76c8f8675194551a3da574 (patch)
tree4f1bc13e86ba6c75ec054ace85eddb938201d1ab /lib/mpi/mpi-mod.c
parent91fd38ea7589fd8276720c20eadacd980be8bbe4 (diff)
lib/sg_pool: change module_init(sg_pool_init) to subsys_initcall
sg_alloc_table_chained() is called by several drivers, but if it is called before sg_pool_init(), it results in a NULL pointer dereference in sg_pool_alloc(). Since commit 9b1d6c895002 ("lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c"), we rely on module_init(sg_pool_init) is invoked before other module_init calls but this assumption is fragile. I slightly changed the link order while refactoring Kbuild, then uncovered this issue. I should keep the current link order, but depending on a specific call order among module_init is so fragile. We usually define the init order by specifying *_initcall correctly, or delay the driver probing by returning -EPROBE_DEFER. Change module_initcall() to subsys_initcall(), and also delete the pointless module_exit() because lib/sg_pool.c is always compiled as built-in. (CONFIG_SG_POOL is bool) Link: https://lore.kernel.org/all/[email protected]/ Link: https://lore.kernel.org/all/[email protected]/ Fixes: 9b1d6c895002 ("lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c") Reported-by: Guenter Roeck <[email protected]> Reported-by: Marek Szyprowski <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-mod.c')
0 files changed, 0 insertions, 0 deletions