From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Vikash Garodia <quic_vgarodia@quicinc.com>,
stanimir.k.varbanov@gmail.com, bryan.odonoghue@linaro.org,
agross@kernel.org, andersson@kernel.org, mchehab@kernel.org,
hans.verkuil@cisco.com, tfiga@chromium.org
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/4] venus: hfi: add checks to perform sanity on queue pointers
Date: Thu, 27 Jul 2023 19:08:14 +0200 [thread overview]
Message-ID: <df947545-23ef-2ee9-72cc-8e54bbe46be1@linaro.org> (raw)
In-Reply-To: <1690432469-14803-2-git-send-email-quic_vgarodia@quicinc.com>
On 27.07.2023 06:34, Vikash Garodia wrote:
> Read and write pointers are used to track the packet index in the memory
> shared between video driver and firmware. There is a possibility of OOB
> access if the read or write pointer goes beyond the queue memory size.
> Add checks for the read and write pointer to avoid OOB access.
>
> Cc: stable@vger.kernel.org
> Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
> Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
> ---
> drivers/media/platform/qcom/venus/hfi_venus.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> index f0b4638..dc228c4 100644
> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> @@ -206,6 +206,10 @@ static int venus_write_queue(struct venus_hfi_device *hdev,
>
> new_wr_idx = wr_idx + dwords;
> wr_ptr = (u32 *)(queue->qmem.kva + (wr_idx << 2));
> +
> + if (wr_ptr < (u32 *)queue->qmem.kva || wr_ptr > (u32 *)(queue->qmem.kva + queue->qmem.size))
Shouldn't the cases on the right side of the OR operator include a
"- 1"?
Konrad
next prev parent reply other threads:[~2023-07-27 17:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 4:34 [PATCH 0/4] Venus driver fixes to avoid possible OOB accesses Vikash Garodia
2023-07-27 4:34 ` [PATCH 1/4] venus: hfi: add checks to perform sanity on queue pointers Vikash Garodia
2023-07-27 17:08 ` Konrad Dybcio [this message]
2023-07-28 7:56 ` Vikash Garodia
2023-07-27 4:34 ` [PATCH 2/4] venus: hfi: fix the check to handle session buffer requirement Vikash Garodia
2023-07-28 19:12 ` Nathan Hebert
2023-07-27 4:34 ` [PATCH 3/4] venus: hfi: add checks to handle capabilities from firmware Vikash Garodia
2023-07-28 21:14 ` Nathan Hebert
2023-07-27 4:34 ` [PATCH 4/4] venus: hfi_parser: Add check to keep the number of codecs within range Vikash Garodia
2023-07-27 17:11 ` Konrad Dybcio
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=df947545-23ef-2ee9-72cc-8e54bbe46be1@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=hans.verkuil@cisco.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=quic_vgarodia@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=stanimir.k.varbanov@gmail.com \
--cc=tfiga@chromium.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®