* [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX
@ 2018-10-03 5:40 Arun Kumar Neelakantam
2018-10-04 4:37 ` Bjorn Andersson
2018-11-14 18:02 ` Andy Gross
0 siblings, 2 replies; 3+ messages in thread
From: Arun Kumar Neelakantam @ 2018-10-03 5:40 UTC (permalink / raw)
To: davem, bjorn.andersson, clew
Cc: netdev, linux-kernel, linux-arm-msm, fw, hannes, dvlasenk,
nicolas.dechesne, Arun Kumar Neelakantam, Andy Gross,
David Brown, open list:ARM/QUALCOMM SUPPORT
Txn IDs created up to INT_MAX cause overflow while storing
the IDs in u16 type supported by QMI header.
Limit the txn IDs max value to U16_MAX to avoid overflow.
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
drivers/soc/qcom/qmi_interface.c | 2 +-
include/linux/soc/qcom/qmi.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c
index 938ca41c..c239a28 100644
--- a/drivers/soc/qcom/qmi_interface.c
+++ b/drivers/soc/qcom/qmi_interface.c
@@ -318,7 +318,7 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn,
txn->dest = c_struct;
mutex_lock(&qmi->txn_lock);
- ret = idr_alloc_cyclic(&qmi->txns, txn, 0, INT_MAX, GFP_KERNEL);
+ ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL);
if (ret < 0)
pr_err("failed to allocate transaction id\n");
diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h
index f4de336..5efa2b6 100644
--- a/include/linux/soc/qcom/qmi.h
+++ b/include/linux/soc/qcom/qmi.h
@@ -166,7 +166,7 @@ struct qmi_ops {
struct qmi_txn {
struct qmi_handle *qmi;
- int id;
+ u16 id;
struct mutex lock;
struct completion completion;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX
2018-10-03 5:40 [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX Arun Kumar Neelakantam
@ 2018-10-04 4:37 ` Bjorn Andersson
2018-11-14 18:02 ` Andy Gross
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2018-10-04 4:37 UTC (permalink / raw)
To: Arun Kumar Neelakantam
Cc: davem, clew, netdev, linux-kernel, linux-arm-msm, fw, hannes,
dvlasenk, nicolas.dechesne, Andy Gross, David Brown,
open list:ARM/QUALCOMM SUPPORT
On Tue 02 Oct 22:40 PDT 2018, Arun Kumar Neelakantam wrote:
> Txn IDs created up to INT_MAX cause overflow while storing
> the IDs in u16 type supported by QMI header.
>
> Limit the txn IDs max value to U16_MAX to avoid overflow.
>
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> ---
> drivers/soc/qcom/qmi_interface.c | 2 +-
> include/linux/soc/qcom/qmi.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c
> index 938ca41c..c239a28 100644
> --- a/drivers/soc/qcom/qmi_interface.c
> +++ b/drivers/soc/qcom/qmi_interface.c
> @@ -318,7 +318,7 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn,
> txn->dest = c_struct;
>
> mutex_lock(&qmi->txn_lock);
> - ret = idr_alloc_cyclic(&qmi->txns, txn, 0, INT_MAX, GFP_KERNEL);
> + ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL);
> if (ret < 0)
> pr_err("failed to allocate transaction id\n");
>
> diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h
> index f4de336..5efa2b6 100644
> --- a/include/linux/soc/qcom/qmi.h
> +++ b/include/linux/soc/qcom/qmi.h
> @@ -166,7 +166,7 @@ struct qmi_ops {
> struct qmi_txn {
> struct qmi_handle *qmi;
>
> - int id;
> + u16 id;
>
> struct mutex lock;
> struct completion completion;
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX
2018-10-03 5:40 [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX Arun Kumar Neelakantam
2018-10-04 4:37 ` Bjorn Andersson
@ 2018-11-14 18:02 ` Andy Gross
1 sibling, 0 replies; 3+ messages in thread
From: Andy Gross @ 2018-11-14 18:02 UTC (permalink / raw)
To: Arun Kumar Neelakantam
Cc: davem, bjorn.andersson, clew, netdev, linux-kernel,
linux-arm-msm, fw, hannes, dvlasenk, nicolas.dechesne,
David Brown, open list:ARM/QUALCOMM SUPPORT
On Wed, Oct 03, 2018 at 11:10:02AM +0530, Arun Kumar Neelakantam wrote:
> Txn IDs created up to INT_MAX cause overflow while storing
> the IDs in u16 type supported by QMI header.
>
> Limit the txn IDs max value to U16_MAX to avoid overflow.
>
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
> ---
Thanks for sending this in. I'll queue it up.
Andy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-14 18:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 5:40 [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX Arun Kumar Neelakantam
2018-10-04 4:37 ` Bjorn Andersson
2018-11-14 18:02 ` Andy Gross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).