Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hemanth Selam" <hemanth.selam@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/2] scsi: fix typos in comments
Date: Fri, 04 Sep 2026 12:26:56 +0000	[thread overview]
Message-ID: <20260904122657.3B6B41F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904121449.24178-2-hemanth.selam@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Double completion and use-after-free race between normal I/O completion and abort timeout.
--

commit 557225524672ba2157c18527e3000f5d88170125
Author: Hemanth Selam <hemanth.selam@gmail.com>
Subject: scsi: fix typos in comments

Fix typos in comments, reported by scripts/checkpatch.pl using the
misspelling list in scripts/spelling.txt.  Only touches comments, no code
changes.

> diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
> index 0114e70e98844..ff924be3ecbb9 100644
> --- a/drivers/scsi/csiostor/csio_scsi.c
> +++ b/drivers/scsi/csiostor/csio_scsi.c
[ ... ]
> @@ -1968,7 +1968,7 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
>  
>  	wait_for_completion_timeout(&ioreq->cmplobj, msecs_to_jiffies(tmo));
>  
> -	/* FW didnt respond to abort within our timeout */
> +	/* FW didn't respond to abort within our timeout */
>  	if (((struct scsi_cmnd *)csio_scsi_cmnd(ioreq)) == cmnd) {

[Severity: High]
This is a pre-existing issue, but it appears there might be a race condition
between normal io completion and the abort timeout here.

Looking at csio_eh_abort_handler() in drivers/scsi/csiostor/csio_scsi.c around
line 1968, the driver waits for an abort response via
wait_for_completion_timeout(). If this times out, it locklessly checks if
csio_scsi_cmnd(ioreq) == cmnd.

Concurrently, if the firmware completes the original io, the interrupt
handler calls csio_scsi_err_handler(), which unmaps the dma and completes the
command:

drivers/scsi/csiostor/csio_scsi.c:csio_scsi_err_handler() {
        ...
        scsi_done(cmnd);

        /* Wake up waiting threads */
        csio_scsi_cmnd(req) = NULL;
        complete(&req->cmplobj);
}

If the abort handler's lockless read occurs between the scsi_done(cmnd) call
and the pointer assignment csio_scsi_cmnd(req) = NULL, could it mistakenly
observe that the command has not been completed yet?

This sequence would cause csio_eh_abort_handler() to proceed into its timeout
recovery path and execute a second completion on the potentially already freed
command.

>  
>  		csio_err(hw, "Abort timed out -- req: %p\n", ioreq);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260904121449.24178-1-hemanth.selam@gmail.com?part=1

  reply	other threads:[~2026-09-04 12:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260904121449.24178-1-hemanth.selam@gmail.com>
2026-09-04 12:14 ` [PATCH 1/2] scsi: fix typos in comments Hemanth Selam
2026-09-04 12:26   ` sashiko-bot [this message]
2026-09-04 12:14 ` [PATCH 2/2] scsi: fix repeated words " Hemanth Selam
2026-09-07  4:24   ` Hemanth Selam

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=20260904122657.3B6B41F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=hemanth.selam@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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