This is a note to let you know that I've just added the patch titled firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit to the 6.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: firmware-qcom_scm-use-64-bit-calling-convention-only-when-client-is-64-bit.patch and it can be found in the queue-6.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 3337a6fea25370d3d244ec6bb38c71ee86fcf837 Mon Sep 17 00:00:00 2001 From: Kathiravan Thirumoorthy <quic_kathirav@xxxxxxxxxxx> Date: Mon, 25 Sep 2023 13:59:22 +0530 Subject: firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit From: Kathiravan Thirumoorthy <quic_kathirav@xxxxxxxxxxx> commit 3337a6fea25370d3d244ec6bb38c71ee86fcf837 upstream. Per the "SMC calling convention specification", the 64-bit calling convention can only be used when the client is 64-bit. Whereas the 32-bit calling convention can be used by either a 32-bit or a 64-bit client. Currently during SCM probe, irrespective of the client, 64-bit calling convention is made, which is incorrect and may lead to the undefined behaviour when the client is 32-bit. Let's fix it. Cc: stable@xxxxxxxxxxxxxxx Fixes: 9a434cee773a ("firmware: qcom_scm: Dynamically support SMCCC and legacy conventions") Reviewed-By: Elliot Berman <quic_eberman@xxxxxxxxxxx> Signed-off-by: Kathiravan Thirumoorthy <quic_kathirav@xxxxxxxxxxx> Link: https://lore.kernel.org/r/20230925-scm-v3-1-8790dff6a749@xxxxxxxxxxx Signed-off-by: Bjorn Andersson <andersson@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/firmware/qcom_scm.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -172,6 +172,12 @@ static enum qcom_scm_convention __get_co return qcom_scm_convention; /* + * Per the "SMC calling convention specification", the 64-bit calling + * convention can only be used when the client is 64-bit, otherwise + * system will encounter the undefined behaviour. + */ +#if IS_ENABLED(CONFIG_ARM64) + /* * Device isn't required as there is only one argument - no device * needed to dma_map_single to secure world */ @@ -191,6 +197,7 @@ static enum qcom_scm_convention __get_co forced = true; goto found; } +#endif probed_convention = SMC_CONVENTION_ARM_32; ret = __scm_smc_call(NULL, &desc, probed_convention, &res, true); Patches currently in stable-queue which might be from quic_kathirav@xxxxxxxxxxx are queue-6.5/clk-qcom-ipq8074-drop-the-clk_set_rate_parent-flag-from-pll-clocks.patch queue-6.5/clk-qcom-ipq6018-drop-the-clk_set_rate_parent-flag-from-pll-clocks.patch queue-6.5/firmware-qcom_scm-use-64-bit-calling-convention-only-when-client-is-64-bit.patch