]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei
authorMukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Thu, 29 Jan 2026 15:23:20 +0000 (20:53 +0530)
committerBjorn Andersson <andersson@kernel.org>
Mon, 16 Mar 2026 01:36:05 +0000 (20:36 -0500)
It looks element length declared in servreg_loc_pfr_req_ei for reason
not matching servreg_loc_pfr_req's reason field due which we could
observe decoding error on PD crash.

  qmi_decode_string_elem: String len 81 >= Max Len 65

Fix this by matching with servreg_loc_pfr_req's reason field.

Fixes: 1ebcde047c54 ("soc: qcom: add pd-mapper implementation")
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Tested-by: Nikita Travkin <nikita@trvn.ru>
Link: https://lore.kernel.org/r/20260129152320.3658053-2-mukesh.ojha@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/pdr_internal.h
drivers/soc/qcom/qcom_pdr_msg.c
include/linux/soc/qcom/pdr.h

index 039508c1bbf7d0b2e9e60114b6c05926211f6ca2..047c0160b61788123167a4ea8cf5bee23b064573 100644 (file)
@@ -84,7 +84,7 @@ struct servreg_set_ack_resp {
 
 struct servreg_loc_pfr_req {
        char service[SERVREG_NAME_LENGTH + 1];
-       char reason[257];
+       char reason[SERVREG_PFR_LENGTH + 1];
 };
 
 struct servreg_loc_pfr_resp {
index ca98932140d87346b2a5216fccfc0af412209749..02022b11ecf05fd3de9a9bf098b79183ee098beb 100644 (file)
@@ -325,7 +325,7 @@ const struct qmi_elem_info servreg_loc_pfr_req_ei[] = {
        },
        {
                .data_type = QMI_STRING,
-               .elem_len = SERVREG_NAME_LENGTH + 1,
+               .elem_len = SERVREG_PFR_LENGTH + 1,
                .elem_size = sizeof(char),
                .array_type = VAR_LEN_ARRAY,
                .tlv_type = 0x02,
index 83a8ea612e69a359b702fb5b29cbc055246386d6..2b7691e47c2a95c8e76aea095dd526c52ecac006 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/soc/qcom/qmi.h>
 
 #define SERVREG_NAME_LENGTH    64
+#define SERVREG_PFR_LENGTH     256
 
 struct pdr_service;
 struct pdr_handle;