From: Greg Kroah-Hartman Date: Tue, 8 Apr 2025 10:26:02 +0000 (+0200) Subject: 6.13-stable patches X-Git-Tag: v5.4.292~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc3c7c114e7137ad9392f8eaa8d122ab2e0aff69;p=thirdparty%2Fkernel%2Fstable-queue.git 6.13-stable patches added patches: asoc-cs42l43-convert-to-system_sleep_pm_ops.patch platform-x86-amd-pmf-fix-cleanup-in-amd_pmf_init_smart_pc.patch --- diff --git a/queue-6.13/asoc-cs42l43-convert-to-system_sleep_pm_ops.patch b/queue-6.13/asoc-cs42l43-convert-to-system_sleep_pm_ops.patch new file mode 100644 index 0000000000..d60b28e4df --- /dev/null +++ b/queue-6.13/asoc-cs42l43-convert-to-system_sleep_pm_ops.patch @@ -0,0 +1,39 @@ +From 658fb7fe8e7f4014ea17a4da0e0c1d9bc319fa35 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 5 Mar 2025 18:27:32 +0100 +Subject: ASoC: cs42l43: convert to SYSTEM_SLEEP_PM_OPS + +From: Arnd Bergmann + +commit 658fb7fe8e7f4014ea17a4da0e0c1d9bc319fa35 upstream. + +The custom suspend function causes a build warning when CONFIG_PM_SLEEP +is disabled: + +sound/soc/codecs/cs42l43.c:2405:12: error: unused function 'cs42l43_codec_runtime_force_suspend' [-Werror,-Wunused-function] + +Change SET_SYSTEM_SLEEP_PM_OPS() to the newer SYSTEM_SLEEP_PM_OPS(), +to avoid this. + +Fixes: 164b7dd4546b ("ASoC: cs42l43: Add jack delay debounce after suspend") +Signed-off-by: Arnd Bergmann +Reviewed-by: Maciej Strozek +Reviewed-by: Charles Keepax +Link: https://patch.msgid.link/20250305172738.3437513-1-arnd@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/codecs/cs42l43.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/codecs/cs42l43.c ++++ b/sound/soc/codecs/cs42l43.c +@@ -2417,7 +2417,7 @@ static int cs42l43_codec_runtime_force_s + + static const struct dev_pm_ops cs42l43_codec_pm_ops = { + RUNTIME_PM_OPS(NULL, cs42l43_codec_runtime_resume, NULL) +- SET_SYSTEM_SLEEP_PM_OPS(cs42l43_codec_runtime_force_suspend, pm_runtime_force_resume) ++ SYSTEM_SLEEP_PM_OPS(cs42l43_codec_runtime_force_suspend, pm_runtime_force_resume) + }; + + static const struct platform_device_id cs42l43_codec_id_table[] = { diff --git a/queue-6.13/platform-x86-amd-pmf-fix-cleanup-in-amd_pmf_init_smart_pc.patch b/queue-6.13/platform-x86-amd-pmf-fix-cleanup-in-amd_pmf_init_smart_pc.patch new file mode 100644 index 0000000000..12d5956d9c --- /dev/null +++ b/queue-6.13/platform-x86-amd-pmf-fix-cleanup-in-amd_pmf_init_smart_pc.patch @@ -0,0 +1,132 @@ +From 5b1122fc4995f308b21d7cfc64ef9880ac834d20 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Mon, 10 Mar 2025 22:48:29 +0300 +Subject: platform/x86/amd/pmf: fix cleanup in amd_pmf_init_smart_pc() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Dan Carpenter + +commit 5b1122fc4995f308b21d7cfc64ef9880ac834d20 upstream. + +There are a few problems in this code: + +First, if amd_pmf_tee_init() fails then the function returns directly +instead of cleaning up. We cannot simply do a "goto error;" because +the amd_pmf_tee_init() cleanup calls tee_shm_free(dev->fw_shm_pool); +and amd_pmf_tee_deinit() calls it as well leading to a double free. +I have re-written this code to use an unwind ladder to free the +allocations. + +Second, if amd_pmf_start_policy_engine() fails on every iteration though +the loop then the code calls amd_pmf_tee_deinit() twice which is also a +double free. Call amd_pmf_tee_deinit() inside the loop for each failed +iteration. Also on that path the error codes are not necessarily +negative kernel error codes. Set the error code to -EINVAL. + +There is a very subtle third bug which is that if the call to +input_register_device() in amd_pmf_register_input_device() fails then +we call input_unregister_device() on an input device that wasn't +registered. This will lead to a reference counting underflow +because of the device_del(&dev->dev) in __input_unregister_device(). +It's unlikely that anyone would ever hit this bug in real life. + +Fixes: 376a8c2a1443 ("platform/x86/amd/pmf: Update PMF Driver for Compatibility with new PMF-TA") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/232231fc-6a71-495e-971b-be2a76f6db4c@stanley.mountain +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/x86/amd/pmf/tee-if.c | 36 +++++++++++++++++++++++----------- + 1 file changed, 25 insertions(+), 11 deletions(-) + +--- a/drivers/platform/x86/amd/pmf/tee-if.c ++++ b/drivers/platform/x86/amd/pmf/tee-if.c +@@ -510,18 +510,18 @@ int amd_pmf_init_smart_pc(struct amd_pmf + + ret = amd_pmf_set_dram_addr(dev, true); + if (ret) +- goto error; ++ goto err_cancel_work; + + dev->policy_base = devm_ioremap_resource(dev->dev, dev->res); + if (IS_ERR(dev->policy_base)) { + ret = PTR_ERR(dev->policy_base); +- goto error; ++ goto err_free_dram_buf; + } + + dev->policy_buf = kzalloc(dev->policy_sz, GFP_KERNEL); + if (!dev->policy_buf) { + ret = -ENOMEM; +- goto error; ++ goto err_free_dram_buf; + } + + memcpy_fromio(dev->policy_buf, dev->policy_base, dev->policy_sz); +@@ -531,13 +531,13 @@ int amd_pmf_init_smart_pc(struct amd_pmf + dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL); + if (!dev->prev_data) { + ret = -ENOMEM; +- goto error; ++ goto err_free_policy; + } + + for (i = 0; i < ARRAY_SIZE(amd_pmf_ta_uuid); i++) { + ret = amd_pmf_tee_init(dev, &amd_pmf_ta_uuid[i]); + if (ret) +- return ret; ++ goto err_free_prev_data; + + ret = amd_pmf_start_policy_engine(dev); + switch (ret) { +@@ -550,27 +550,41 @@ int amd_pmf_init_smart_pc(struct amd_pmf + status = false; + break; + default: +- goto error; ++ ret = -EINVAL; ++ amd_pmf_tee_deinit(dev); ++ goto err_free_prev_data; + } + + if (status) + break; + } + +- if (!status && !pb_side_load) +- goto error; ++ if (!status && !pb_side_load) { ++ ret = -EINVAL; ++ goto err_free_prev_data; ++ } + + if (pb_side_load) + amd_pmf_open_pb(dev, dev->dbgfs_dir); + + ret = amd_pmf_register_input_device(dev); + if (ret) +- goto error; ++ goto err_pmf_remove_pb; + + return 0; + +-error: +- amd_pmf_deinit_smart_pc(dev); ++err_pmf_remove_pb: ++ if (pb_side_load && dev->esbin) ++ amd_pmf_remove_pb(dev); ++ amd_pmf_tee_deinit(dev); ++err_free_prev_data: ++ kfree(dev->prev_data); ++err_free_policy: ++ kfree(dev->policy_buf); ++err_free_dram_buf: ++ kfree(dev->buf); ++err_cancel_work: ++ cancel_delayed_work_sync(&dev->pb_work); + + return ret; + } diff --git a/queue-6.13/series b/queue-6.13/series index 9f9359c35d..8c90933631 100644 --- a/queue-6.13/series +++ b/queue-6.13/series @@ -496,3 +496,5 @@ nfsd-fix-management-of-listener-transports.patch nfsd-nfsd_unlink-clobbers-non-zero-status-returned-from-fh_fill_pre_attrs.patch nfsd-never-return-nfs4err_file_open-when-removing-a-directory.patch nfsd-skip-sending-cb_recall_any-when-the-backchannel-isn-t-up.patch +asoc-cs42l43-convert-to-system_sleep_pm_ops.patch +platform-x86-amd-pmf-fix-cleanup-in-amd_pmf_init_smart_pc.patch