]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
soc: qcom: cmd-db: Use devm_memremap() to fix memory leak in cmd_db_dev_probe
authorHaotian Zhang <vulab@iscas.ac.cn>
Tue, 16 Dec 2025 01:39:32 +0000 (09:39 +0800)
committerBjorn Andersson <andersson@kernel.org>
Wed, 7 Jan 2026 18:42:30 +0000 (12:42 -0600)
commit0da7824734d8d83e6a844dd0207f071cb0c50cf4
treef6982ce06aed5c2a5e6009b68c21b27a4547ffa5
parent0539c5a6fdef1b274112638aa5aa722b1df5e711
soc: qcom: cmd-db: Use devm_memremap() to fix memory leak in cmd_db_dev_probe

If cmd_db_magic_matches() fails after memremap() succeeds, the function
returns -EINVAL without unmapping the memory region, causing a
potential resource leak.

Switch to devm_memremap to automatically manage the map resource.

Fixes: 312416d9171a ("drivers: qcom: add command DB driver")
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/r/20251216013933.773-1-vulab@iscas.ac.cn
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/cmd-db.c