linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>, Avi Kivity <avi@scylladb.com>,
	linux-aio@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] aio: refactor read/write iocb setup
Date: Fri, 6 Apr 2018 09:10:11 +0200	[thread overview]
Message-ID: <20180406071011.GA21308@lst.de> (raw)
In-Reply-To: <20180406032146.GV30522@ZenIV.linux.org.uk>

On Fri, Apr 06, 2018 at 04:21:46AM +0100, Al Viro wrote:
> On Wed, Mar 28, 2018 at 09:26:36AM +0200, Christoph Hellwig wrote:
> > +		struct inode *inode = file_inode(file);
> > +
> >  		req->ki_flags |= IOCB_WRITE;
> >  		file_start_write(file);
> > -		ret = aio_ret(req, call_write_iter(file, req, &iter));
> > +		ret = aio_rw_ret(req, call_write_iter(file, req, &iter));
> >  		/*
> > -		 * We release freeze protection in aio_complete().  Fool lockdep
> > -		 * by telling it the lock got released so that it doesn't
> > -		 * complain about held lock when we return to userspace.
> > +		 * We release freeze protection in aio_complete_rw().  Fool
> > +		 * lockdep by telling it the lock got released so that it
> > +		 * doesn't complain about held lock when we return to userspace.
> >  		 */
> > -		if (S_ISREG(file_inode(file)->i_mode))
> > -			__sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE);
> > +		if (S_ISREG(inode->i_mode))
> 
> ... and that's another use-after-free, since we might've already done fput() of
> that sucker by that point.

Indeed.  Not in any way new in this patch, this is an existing issue
dating way back that needs to be fixed, which will be rather annoying
without taking an extra reference to the inode or at least sb.

  reply	other threads:[~2018-04-06  7:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28  7:26 io_pgetevents & aio fsync V2 Christoph Hellwig
2018-03-28  7:26 ` [PATCH 1/6] aio: don't print the page size at boot time Christoph Hellwig
2018-03-28  7:26 ` [PATCH 2/6] aio: remove an outdated comment in aio_complete Christoph Hellwig
2018-03-28 16:05   ` Darrick J. Wong
2018-03-28 17:05   ` Matthew Wilcox
2018-03-28  7:26 ` [PATCH 3/6] aio: refactor read/write iocb setup Christoph Hellwig
2018-04-06  3:21   ` Al Viro
2018-04-06  7:10     ` Christoph Hellwig [this message]
2018-04-06 12:28       ` Al Viro
2018-03-28  7:26 ` [PATCH 4/6] aio: sanitize ki_list handling Christoph Hellwig
2018-03-28  7:26 ` [PATCH 5/6] aio: implement IOCB_CMD_FSYNC and IOCB_CMD_FDSYNC Christoph Hellwig
2018-04-06  2:59   ` Al Viro
2018-03-28  7:26 ` [PATCH 6/6] aio: implement io_pgetevents Christoph Hellwig
2018-04-06  3:16 ` io_pgetevents & aio fsync V2 Al Viro
2018-04-06  6:27   ` Christoph Hellwig
2018-04-06 12:57     ` Jeff Moyer

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=20180406071011.GA21308@lst.de \
    --to=hch@lst.de \
    --cc=avi@scylladb.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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).