From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 3/3] scsi: arcmsr: wrap the type B completion index before using it
Date: Mon, 12 Oct 2026 11:59:23 +0000 [thread overview]
Message-ID: <sashiko-outbox-168041@kernel.org> (raw)
In-Reply-To: <459990a0367f7268c0056098f6e2631700e20327.1791803953.git.yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] scsi: arcmsr: infinite loop in ISR processing due to unbounded hardware DMA
--
commit 728fbf206bd1c95a2cfbe31aec39150fac1e1356
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
scsi: arcmsr: wrap the type B completion index before using it
This commit fixes a KASAN slab-out-of-bounds issue in arcmsr_hbaB_postqueue_isr
and arcmsr_hbaB_polling_ccbdone by wrapping the doneq_index with
ARCMSR_MAX_HBB_POSTQUEUE before it is used to index into done_qbuffer[].
> diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
> index e635b76daae9a..d13bd0febb81a 100644
> --- a/drivers/scsi/arcmsr/arcmsr_hba.c
> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c
> @@ -2568,7 +2568,7 @@ static void arcmsr_hbaB_postqueue_isr(struct AdapterControlBlock *acb)
> bool error;
> unsigned long cdb_phy_addr;
>
> - index = reg->doneq_index;
> + index = reg->doneq_index % ARCMSR_MAX_HBB_POSTQUEUE;
> while ((flag_ccb = reg->done_qbuffer[index]) != 0) {
[Severity: Medium]
Could this loop spin infinitely? The loop condition depends entirely on
hardware-controlled DMA memory without an iteration limit.
If a faulty or malicious PCIe device continuously populates the DMA-mapped
done_qbuffer faster than the CPU processes it, or supplies an endless stream
of non-zero completions, can this lead to a CPU soft or hard lockup?
> cdb_phy_addr = (flag_ccb << 5) & 0xffffffff;
> if (acb->cdb_phyadd_hipart)
[ ... ]
> @@ -3671,7 +3671,7 @@ static int arcmsr_hbaB_polling_ccbdone(struct AdapterControlBlock *acb,
> /* clear doorbell interrupt */
> writel(ARCMSR_DOORBELL_INT_CLEAR_PATTERN, reg->iop2drv_doorbell);
> while(1){
> - index = reg->doneq_index;
> + index = reg->doneq_index % ARCMSR_MAX_HBB_POSTQUEUE;
> flag_ccb = reg->done_qbuffer[index];
> if (flag_ccb == 0) {
[Severity: Medium]
Could this polling loop also lack a structural bound and spin infinitely?
If the hardware continuously supplies non-zero completions, poll_count is only
evaluated when flag_ccb == 0. Can this result in a denial of service if the
hardware never returns a zero completion?
> if (poll_ccb_done){
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791803953.git.yhlee@isslab.korea.ac.kr?part=3
next prev parent reply other threads:[~2026-10-12 11:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 11:41 [PATCH v3 0/3] scsi: arcmsr: bound adapter-supplied completion indices and message lengths Yehyeong Lee
2026-10-12 11:41 ` [PATCH v3 1/3] scsi: arcmsr: bound the firmware-supplied message length Yehyeong Lee
2026-10-12 11:54 ` sashiko-bot
2026-10-12 12:16 ` Yehyeong Lee
2026-10-12 11:41 ` [PATCH v3 2/3] scsi: arcmsr: check the completion index the adapter reports Yehyeong Lee
2026-10-12 11:41 ` [PATCH v3 3/3] scsi: arcmsr: wrap the type B completion index before using it Yehyeong Lee
2026-10-12 11:59 ` sashiko-bot [this message]
2026-10-12 12:16 ` Yehyeong Lee
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=sashiko-outbox-168041@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yhlee@isslab.korea.ac.kr \
/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