mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] soc: qcom: geni-se: Fix write to read-only firmware buffer
Date: Thu, 20 Aug 2026 20:04:18 +0530	[thread overview]
Message-ID: <7e863f09-473a-48bf-bc2d-c7a8122b27bc@oss.qualcomm.com> (raw)
In-Reply-To: <3b924a67-a229-4836-abc9-0985e3e10d4d@oss.qualcomm.com>



On 8/19/2026 6:44 PM, Konrad Dybcio wrote:
> On 8/19/26 12:14 PM, Viken Dadhaniya wrote:
>> geni_find_protocol_fw() casts fw->data to a non-const struct se_fw_hdr
>> pointer and writes back a rounded-up fw_size value:
>>
>>         sefw->fw_size_in_items = cpu_to_le16(fw_size);
>>
>> The firmware subsystem maps the firmware blob read-only. Writing through
>> the cast pointer causes a level-3 permission fault on AArch64 and
>> crashes the kernel during driver probe.
> 
> Bug 1
> 
>> Remove the write-back. fw_size is u16, so incrementing 0xffff wraps
>> to 0, letting the bounds check pass for an unchecked size; widen it to
>> u32. The bounds check used the unrounded fw_size, so a segment with an
>> odd word count can pass validation but trigger an out-of-bounds read
>> during the copy;
> 
> Bug 2
> 
>> round up before computing fw_end. The caller re-reads
>> fw_size_in_items directly, bypassing the validated value; propagate it
>> via a new fw_size_out parameter.
> 
> Bug 3
> 
>> While at it, fix serial_protocol being compared with le32_to_cpu();
>> the field is __le16, which would cause the protocol match to always
>> fail on big-endian.
> 
> Bug 4
> 
> Please split this up

Split into four patches in v2.

> 
> Konrad


      reply	other threads:[~2026-08-20 14:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 10:14 Viken Dadhaniya
2026-08-19 13:14 ` Konrad Dybcio
2026-08-20 14:34   ` Viken Dadhaniya [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e863f09-473a-48bf-bc2d-c7a8122b27bc@oss.qualcomm.com \
    --to=viken.dadhaniya@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.savaliya@oss.qualcomm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®