From: Christoph Hellwig <hch@lst.de>
To: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@lst.de>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
Chandan Rajendra <chandan@linux.ibm.com>,
linux-xfs@vger.kernel.org
Subject: Re: BUG: iomap_dio_rw() accesses freed memory
Date: Tue, 15 Jan 2019 22:09:03 +0100 [thread overview]
Message-ID: <20190115210903.GA15737@lst.de> (raw)
In-Reply-To: <20190115205141.GL4205@dastard>
On Wed, Jan 16, 2019 at 07:51:41AM +1100, Dave Chinner wrote:
> Atomic operations don't imply a memory barrier for dependent data,
> right?
Documentation/atomic_t.txt says:
-------------------------- snip --------------------------
The rule of thumb:
- non-RMW operations are unordered;
- RMW operations that have no return value are unordered;
- RMW operations that have a return value are fully ordered;
[...]
Fully ordered primitives are ordered against everything prior and everything
subsequent. Therefore a fully ordered primitive is like having an smp_mb()
before and an smp_mb() after the primitive.
-------------------------- snip --------------------------
I think atomic_dec_and_test clearly falls into the third category,
and I can't see how much of the kernel could work if that wasn't the
case.
next prev parent reply other threads:[~2019-01-15 21:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 10:17 BUG: iomap_dio_rw() accesses freed memory Chandan Rajendra
2019-01-10 14:25 ` Christoph Hellwig
2019-01-10 16:49 ` Chandan Rajendra
2019-01-10 17:09 ` Darrick J. Wong
2019-01-15 18:27 ` Christoph Hellwig
2019-01-15 20:51 ` Dave Chinner
2019-01-15 21:09 ` Christoph Hellwig [this message]
2019-01-15 23:18 ` Dave Chinner
2019-01-15 23:24 ` Darrick J. Wong
2019-01-16 5:59 ` Chandan Rajendra
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=20190115210903.GA15737@lst.de \
--to=hch@lst.de \
--cc=chandan@linux.ibm.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).