* [PATCH] soc: qcom: qmi_encdec: Restrict string length in decode
@ 2023-07-31 9:14 Praveenkumar I
2023-07-31 9:18 ` Konrad Dybcio
0 siblings, 1 reply; 3+ messages in thread
From: Praveenkumar I @ 2023-07-31 9:14 UTC (permalink / raw)
To: agross, andersson, konrad.dybcio, linux-arm-msm, linux-kernel
Cc: quic_varada, quic_clew
The QMI TLV value for strings in a lot of qmi element info structures
account for null terminated strings with MAX_LEN + 1. If a string is
actually MAX_LEN + 1 length, this will cause an out of bounds access
when the NULL character is appended in decoding.
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
---
drivers/soc/qcom/qmi_encdec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/qmi_encdec.c b/drivers/soc/qcom/qmi_encdec.c
index b7158e3c3a0b..5c7161b18b72 100644
--- a/drivers/soc/qcom/qmi_encdec.c
+++ b/drivers/soc/qcom/qmi_encdec.c
@@ -534,8 +534,8 @@ static int qmi_decode_string_elem(const struct qmi_elem_info *ei_array,
decoded_bytes += rc;
}
- if (string_len > temp_ei->elem_len) {
- pr_err("%s: String len %d > Max Len %d\n",
+ if (string_len >= temp_ei->elem_len) {
+ pr_err("%s: String len %d >= Max Len %d\n",
__func__, string_len, temp_ei->elem_len);
return -ETOOSMALL;
} else if (string_len > tlv_len) {
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] soc: qcom: qmi_encdec: Restrict string length in decode
2023-07-31 9:14 [PATCH] soc: qcom: qmi_encdec: Restrict string length in decode Praveenkumar I
@ 2023-07-31 9:18 ` Konrad Dybcio
2023-07-31 9:55 ` Praveenkumar I
0 siblings, 1 reply; 3+ messages in thread
From: Konrad Dybcio @ 2023-07-31 9:18 UTC (permalink / raw)
To: Praveenkumar I, agross, andersson, linux-arm-msm, linux-kernel
Cc: quic_varada, quic_clew
On 31.07.2023 11:14, Praveenkumar I wrote:
> The QMI TLV value for strings in a lot of qmi element info structures
> account for null terminated strings with MAX_LEN + 1. If a string is
> actually MAX_LEN + 1 length, this will cause an out of bounds access
> when the NULL character is appended in decoding.
>
> Signed-off-by: Chris Lew <quic_clew@quicinc.com>
> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
> ---
Fixes + Cc: stable?
Konrad
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: qcom: qmi_encdec: Restrict string length in decode
2023-07-31 9:18 ` Konrad Dybcio
@ 2023-07-31 9:55 ` Praveenkumar I
0 siblings, 0 replies; 3+ messages in thread
From: Praveenkumar I @ 2023-07-31 9:55 UTC (permalink / raw)
To: Konrad Dybcio, agross, andersson, linux-arm-msm, linux-kernel
Cc: quic_varada, quic_clew
On 7/31/2023 2:48 PM, Konrad Dybcio wrote:
> On 31.07.2023 11:14, Praveenkumar I wrote:
>> The QMI TLV value for strings in a lot of qmi element info structures
>> account for null terminated strings with MAX_LEN + 1. If a string is
>> actually MAX_LEN + 1 length, this will cause an out of bounds access
>> when the NULL character is appended in decoding.
>>
>> Signed-off-by: Chris Lew <quic_clew@quicinc.com>
>> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
>> ---
> Fixes + Cc: stable?
Sure, will add.
>
> Konrad
--
Thanks,
Praveenkumar
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-31 9:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31 9:14 [PATCH] soc: qcom: qmi_encdec: Restrict string length in decode Praveenkumar I
2023-07-31 9:18 ` Konrad Dybcio
2023-07-31 9:55 ` Praveenkumar I
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®