From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "bvanassche@acm.org" <bvanassche@acm.org>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "avri.altman@wdc.com" <avri.altman@wdc.com>,
"ebiggers@google.com" <ebiggers@google.com>,
"santoshsy@gmail.com" <santoshsy@gmail.com>,
"quic_cang@quicinc.com" <quic_cang@quicinc.com>,
"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"manivannan.sadhasivam@linaro.org"
<manivannan.sadhasivam@linaro.org>,
"minwoo.im@samsung.com" <minwoo.im@samsung.com>,
"James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v2] scsi: ufs: core: Fix a race condition related to device commands
Date: Tue, 18 Mar 2025 02:39:28 +0000 [thread overview]
Message-ID: <2a8360280297b17814f4ff5952c5597f3eea184e.camel@mediatek.com> (raw)
In-Reply-To: <20250314225206.1487838-1-bvanassche@acm.org>
On Fri, 2025-03-14 at 15:51 -0700, Bart Van Assche wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> There is a TOCTOU race in ufshcd_compl_one_cqe(): hba-
> >dev_cmd.complete
> may be cleared from another thread after it has been checked and
> before
> it is used. Fix this race by moving the device command completion
> from
> the stack of the device command submitter into struct ufs_hba. This
> patch fixes the following kernel crash:
>
> Unable to handle kernel NULL pointer dereference at virtual address
> 0000000000000008
> Call trace:
> _raw_spin_lock_irqsave+0x34/0x80
> complete+0x24/0xb8
> ufshcd_compl_one_cqe+0x13c/0x4f0
> ufshcd_mcq_poll_cqe_lock+0xb4/0x108
> ufshcd_intr+0x2f4/0x444
> __handle_irq_event_percpu+0xbc/0x250
> handle_irq_event+0x48/0xb0
>
> Fixes: 5a0b0cb9bee7 ("[SCSI] ufs: Add support for sending NOP OUT
> UPIU")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>
> Changes compared to v1:
> - Call init_completion() once instead of every time a device
> management
> command is submitted.
>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
next prev parent reply other threads:[~2025-03-18 2:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 22:51 [PATCH v2] scsi: ufs: core: Fix a race condition related to device commands Bart Van Assche
2025-03-15 8:46 ` Avri Altman
2025-03-17 22:49 ` Bart Van Assche
2025-03-18 2:39 ` Peter Wang (王信友) [this message]
2025-03-21 0:48 ` Martin K. Petersen
2025-04-07 16:59 ` Bart Van Assche
2025-04-07 18:55 ` Martin K. Petersen
2025-04-07 19:18 ` Bart Van Assche
2025-04-07 19:44 ` Martin K. Petersen
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=2a8360280297b17814f4ff5952c5597f3eea184e.camel@mediatek.com \
--to=peter.wang@mediatek.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=avri.altman@wdc.com \
--cc=bvanassche@acm.org \
--cc=ebiggers@google.com \
--cc=jejb@linux.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=minwoo.im@samsung.com \
--cc=quic_cang@quicinc.com \
--cc=santoshsy@gmail.com \
/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