mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Tuo Li <islituo@gmail.com>,
	sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com,
	suganath-prabu.subramani@broadcom.com
Cc: MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, baijiaju1990@outlook.com,
	BassCheck <bass@buaa.edu.cn>
Subject: Re: [PATCH] scsi: message: fusion: Fix a possible data race in mpt_ioc_reset()
Date: Tue, 24 Oct 2023 12:03:36 -0700	[thread overview]
Message-ID: <7f9fa4eb-01fb-4581-badf-535f634d0152@acm.org> (raw)
In-Reply-To: <20231024072729.455713-1-islituo@gmail.com>

On 10/24/23 00:27, Tuo Li wrote:
> In my opinion, this may be a harmful race, because the value of
> ioc->taskmgmt_quiesce_io can be rewritten by mpt_ioc_reset() when
> another thread is accessing it.

It is a common pattern in the Linux kernel that a variable is set from
one thread without using locking and is read by another thread that is
holding a lock. It should be sufficient here to use WRITE_ONCE(). I
don't think that acquiring and releasing the spin lock is required.

Thanks,

Bart.


  reply	other threads:[~2023-10-24 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24  7:27 Tuo Li
2023-10-24 19:03 ` Bart Van Assche [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-07-15  2:53 Tuo Li

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=7f9fa4eb-01fb-4581-badf-535f634d0152@acm.org \
    --to=bvanassche@acm.org \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=baijiaju1990@outlook.com \
    --cc=bass@buaa.edu.cn \
    --cc=islituo@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sathya.prakash@broadcom.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.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

all inboxes | Powered by JetHome®