mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei
@ 2026-02-02 10:36 Mukesh Ojha
  2026-02-02 10:36 ` [PATCH v2 2/2] soc: qcom: qmi: Print error codes in failure paths Mukesh Ojha
  2026-03-04 20:07 ` [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Bjorn Andersson
  0 siblings, 2 replies; 4+ messages in thread
From: Mukesh Ojha @ 2026-02-02 10:36 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov, Chris Lew
  Cc: linux-arm-msm, linux-kernel, Mukesh Ojha, stable,
	Dmitry Baryshkov, Gokul Krishnakumar

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.

Cc: stable@vger.kernel.org
Fixes: 1ebcde047c54 ("soc: qcom: add pd-mapper implementation")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Co-developed-by: Gokul Krishnakumar <gokul.krishnakumar@oss.qualcomm.com>
Signed-off-by: Gokul Krishnakumar <gokul.krishnakumar@oss.qualcomm.com>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
Changes in v2:
  - Given credit to my colleague Gokul.K who first faced this issue and given
    initial fix and that was later corrected by me.
  - Rebased it on next-20260130 and added stable mailing list, R-b tag.


 drivers/soc/qcom/pdr_internal.h | 2 +-
 drivers/soc/qcom/qcom_pdr_msg.c | 2 +-
 include/linux/soc/qcom/pdr.h    | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/qcom/pdr_internal.h b/drivers/soc/qcom/pdr_internal.h
index 039508c1bbf7..047c0160b617 100644
--- a/drivers/soc/qcom/pdr_internal.h
+++ b/drivers/soc/qcom/pdr_internal.h
@@ -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 {
diff --git a/drivers/soc/qcom/qcom_pdr_msg.c b/drivers/soc/qcom/qcom_pdr_msg.c
index ca98932140d8..02022b11ecf0 100644
--- a/drivers/soc/qcom/qcom_pdr_msg.c
+++ b/drivers/soc/qcom/qcom_pdr_msg.c
@@ -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,
diff --git a/include/linux/soc/qcom/pdr.h b/include/linux/soc/qcom/pdr.h
index 83a8ea612e69..2b7691e47c2a 100644
--- a/include/linux/soc/qcom/pdr.h
+++ b/include/linux/soc/qcom/pdr.h
@@ -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;
-- 
2.50.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] soc: qcom: qmi: Print error codes in failure paths
  2026-02-02 10:36 [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Mukesh Ojha
@ 2026-02-02 10:36 ` Mukesh Ojha
  2026-03-04 20:07 ` [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Bjorn Andersson
  1 sibling, 0 replies; 4+ messages in thread
From: Mukesh Ojha @ 2026-02-02 10:36 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov, Chris Lew
  Cc: linux-arm-msm, linux-kernel, Mukesh Ojha, Dmitry Baryshkov

Few error paths in the qmi_interface module log a failure message but
do not include the actual error code. Include the error value in the log
so debugging failures becomes easier.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
Changes in v2:
 -  Rebased it and added R-b tag.

 drivers/soc/qcom/qmi_interface.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c
index 6500f863aae5..941612b1bd2e 100644
--- a/drivers/soc/qcom/qmi_interface.c
+++ b/drivers/soc/qcom/qmi_interface.c
@@ -321,7 +321,7 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn,
 	mutex_lock(&qmi->txn_lock);
 	ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL);
 	if (ret < 0)
-		pr_err("failed to allocate transaction id\n");
+		pr_err("failed to allocate transaction id: %d\n", ret);
 
 	txn->id = ret;
 	mutex_unlock(&qmi->txn_lock);
@@ -413,7 +413,7 @@ static void qmi_invoke_handler(struct qmi_handle *qmi, struct sockaddr_qrtr *sq,
 
 	ret = qmi_decode_message(buf, len, handler->ei, dest);
 	if (ret < 0)
-		pr_err("failed to decode incoming message\n");
+		pr_err("failed to decode incoming message: %d\n", ret);
 	else
 		handler->fn(qmi, sq, txn, dest);
 
@@ -502,7 +502,7 @@ static void qmi_handle_message(struct qmi_handle *qmi,
 		if (txn->dest && txn->ei) {
 			ret = qmi_decode_message(buf, len, txn->ei, txn->dest);
 			if (ret < 0)
-				pr_err("failed to decode incoming message\n");
+				pr_err("failed to decode incoming message: %d\n", ret);
 
 			txn->result = ret;
 			complete(&txn->completion);
@@ -661,8 +661,8 @@ int qmi_handle_init(struct qmi_handle *qmi, size_t recv_buf_size,
 		if (PTR_ERR(qmi->sock) == -EAFNOSUPPORT) {
 			ret = -EPROBE_DEFER;
 		} else {
-			pr_err("failed to create QMI socket\n");
 			ret = PTR_ERR(qmi->sock);
+			pr_err("failed to create QMI socket: %d\n", ret);
 		}
 		goto err_destroy_wq;
 	}
@@ -766,7 +766,7 @@ static ssize_t qmi_send_message(struct qmi_handle *qmi,
 	if (qmi->sock) {
 		ret = kernel_sendmsg(qmi->sock, &msghdr, &iv, 1, len);
 		if (ret < 0)
-			pr_err("failed to send QMI message\n");
+			pr_err("failed to send QMI message: %d\n", ret);
 	} else {
 		ret = -EPIPE;
 	}
-- 
2.50.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei
  2026-02-02 10:36 [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Mukesh Ojha
  2026-02-02 10:36 ` [PATCH v2 2/2] soc: qcom: qmi: Print error codes in failure paths Mukesh Ojha
@ 2026-03-04 20:07 ` Bjorn Andersson
  2026-03-06 17:59   ` Mukesh Ojha
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Andersson @ 2026-03-04 20:07 UTC (permalink / raw)
  To: Mukesh Ojha
  Cc: Konrad Dybcio, Dmitry Baryshkov, Chris Lew, linux-arm-msm,
	linux-kernel, stable, Dmitry Baryshkov, Gokul Krishnakumar

On Mon, Feb 02, 2026 at 04:06:40PM +0530, Mukesh Ojha wrote:
> 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.
> 
> Cc: stable@vger.kernel.org
> Fixes: 1ebcde047c54 ("soc: qcom: add pd-mapper implementation")
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Co-developed-by: Gokul Krishnakumar <gokul.krishnakumar@oss.qualcomm.com>
> Signed-off-by: Gokul Krishnakumar <gokul.krishnakumar@oss.qualcomm.com>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
> Changes in v2:
>   - Given credit to my colleague Gokul.K who first faced this issue and given
>     initial fix and that was later corrected by me.

If Gokul wrote the patch, please keep him as Author and his
Signed-off-by, then after that you add a line "[mukesh: changed x,y,z]"
followed by your Signed-off-by.

Regards,
Bjorn

>   - Rebased it on next-20260130 and added stable mailing list, R-b tag.
> 
> 
>  drivers/soc/qcom/pdr_internal.h | 2 +-
>  drivers/soc/qcom/qcom_pdr_msg.c | 2 +-
>  include/linux/soc/qcom/pdr.h    | 1 +
>  3 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/qcom/pdr_internal.h b/drivers/soc/qcom/pdr_internal.h
> index 039508c1bbf7..047c0160b617 100644
> --- a/drivers/soc/qcom/pdr_internal.h
> +++ b/drivers/soc/qcom/pdr_internal.h
> @@ -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 {
> diff --git a/drivers/soc/qcom/qcom_pdr_msg.c b/drivers/soc/qcom/qcom_pdr_msg.c
> index ca98932140d8..02022b11ecf0 100644
> --- a/drivers/soc/qcom/qcom_pdr_msg.c
> +++ b/drivers/soc/qcom/qcom_pdr_msg.c
> @@ -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,
> diff --git a/include/linux/soc/qcom/pdr.h b/include/linux/soc/qcom/pdr.h
> index 83a8ea612e69..2b7691e47c2a 100644
> --- a/include/linux/soc/qcom/pdr.h
> +++ b/include/linux/soc/qcom/pdr.h
> @@ -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;
> -- 
> 2.50.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei
  2026-03-04 20:07 ` [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Bjorn Andersson
@ 2026-03-06 17:59   ` Mukesh Ojha
  0 siblings, 0 replies; 4+ messages in thread
From: Mukesh Ojha @ 2026-03-06 17:59 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Konrad Dybcio, Dmitry Baryshkov, Chris Lew, linux-arm-msm,
	linux-kernel, stable, Dmitry Baryshkov, Gokul Krishnakumar

On Wed, Mar 04, 2026 at 02:07:51PM -0600, Bjorn Andersson wrote:
> On Mon, Feb 02, 2026 at 04:06:40PM +0530, Mukesh Ojha wrote:
> > 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.
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: 1ebcde047c54 ("soc: qcom: add pd-mapper implementation")
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > Co-developed-by: Gokul Krishnakumar <gokul.krishnakumar@oss.qualcomm.com>
> > Signed-off-by: Gokul Krishnakumar <gokul.krishnakumar@oss.qualcomm.com>
> > Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> > ---
> > Changes in v2:
> >   - Given credit to my colleague Gokul.K who first faced this issue and given
> >     initial fix and that was later corrected by me.
> 
> If Gokul wrote the patch, please keep him as Author and his
> Signed-off-by, then after that you add a line "[mukesh: changed x,y,z]"
> followed by your Signed-off-by.

Sure, will send v3.

-Mukesh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-06 18:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-02 10:36 [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Mukesh Ojha
2026-02-02 10:36 ` [PATCH v2 2/2] soc: qcom: qmi: Print error codes in failure paths Mukesh Ojha
2026-03-04 20:07 ` [PATCH v2 1/2] soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Bjorn Andersson
2026-03-06 17:59   ` Mukesh Ojha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®